From 596b1f6c91ba5bc8931577214b2369fd4959d0c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Rebours?= Date: Fri, 22 Oct 2021 11:23:46 +0200 Subject: [PATCH] use fs.promises instead of fs/promises --- lib/datastore.js | 4 +--- lib/storage.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) 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 = {}