diff --git a/lib/datastore.js b/lib/datastore.js index 1080956..94a707d 100755 --- a/lib/datastore.js +++ b/lib/datastore.js @@ -425,9 +425,7 @@ class Datastore extends EventEmitter { } countAsync (query) { - const cursor = new Cursor(this, query, async docs => docs.length, true) - - return cursor // this is a trick, Cursor itself is a thenable, which allows to await it + return new Cursor(this, query, async docs => docs.length, true) // this is a trick, Cursor itself is a thenable, which allows to await it } /** diff --git a/lib/storage.js b/lib/storage.js index b5a506a..a027051 100755 --- a/lib/storage.js +++ b/lib/storage.js @@ -7,7 +7,7 @@ * It's essentially fs, mkdirp and crash safe write and read functions */ const fs = require('fs') -const fsPromises = require('fs/promises') +const fsPromises = fs.promises const path = require('path') const { callbackify, promisify } = require('util') const storage = {}