use fs.promises instead of fs/promises

pull/11/head
Timothée Rebours 3 years ago
parent 4df151b203
commit 5a9899e9f4
  1. 4
      lib/datastore.js
  2. 2
      lib/storage.js

@ -425,9 +425,7 @@ class Datastore extends EventEmitter {
} }
countAsync (query) { countAsync (query) {
const cursor = new Cursor(this, query, async docs => docs.length, true) return new Cursor(this, query, async docs => docs.length, true) // this is a trick, Cursor itself is a thenable, which allows to await it
return cursor // this is a trick, Cursor itself is a thenable, which allows to await it
} }
/** /**

@ -7,7 +7,7 @@
* It's essentially fs, mkdirp and crash safe write and read functions * It's essentially fs, mkdirp and crash safe write and read functions
*/ */
const fs = require('fs') const fs = require('fs')
const fsPromises = require('fs/promises') const fsPromises = fs.promises
const path = require('path') const path = require('path')
const { callbackify, promisify } = require('util') const { callbackify, promisify } = require('util')
const storage = {} const storage = {}

Loading…
Cancel
Save