I have this class:
class Blockchain {
    constructor() {
    }
    // Add new block
    async addBlock(newBlock) {
        var bla;
        this.getBlockHeightPromise().then(i => bla = i);
        console.log('bla: ' + bla);}
//Note addBlock needs to async because await db.createReadStream follows
    getBlockHeightPromise() {
        return new Promise(function (resolve, reject) {
            let i = 0;
            db.createReadStream()
                .on('data', function () {
                    i++;
                })
                .on('error', function () {
                    reject("Could not retrieve chain length");
                })
                .on('close', function () {
                    resolve(i);
                });
        })
    }
}
Now when I try to run it, it doesn’t work:
let blockchain = new Blockchain();
blockchain.addBlock(someBlock)
But it works from the command line when I try to run it like this:
let blockchain = new Blockchain();
var bla;
blockchain.getBlockHeightPromise().then(i => bla =  i);
How to make this work?