sergeyksv / tingodb

Embedded Node.js database upward compatible with MongoDB
www.tingodb.com
1.16k stars 105 forks source link

node.js deprecation warning #163

Closed apowers313 closed 6 years ago

apowers313 commented 6 years ago

When _compact gets called, it causes node.js to throw a deprecation warning:

(node:49201) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.

Running with the --trace-warnings flag, I get this trace:

at makeCallback (fs.js:127:12) at Object.fs.close (fs.js:607:20) at /Users/apowers/Projects/components/component-uds-json/node_modules/tingodb/lib/tcoll.js:235:9 at _fnApply (/Users/apowers/Projects/components/component-uds-json/node_modules/safe/lib/safe.js:172:22) at _catcher (/Users/apowers/Projects/components/component-uds-json/node_modules/safe/lib/safe.js:349:11) at /Users/apowers/Projects/components/component-uds-json/node_modules/safe/lib/safe.js:462:4 at _wrapArgsSure (/Users/apowers/Projects/components/component-uds-json/node_modules/safe/lib/safe.js:218:14) at FSReqWrap.oncomplete (fs.js:135:15)

Apparently newer versions of node.js (I'm running v8.9.4) complain if they don't receive a callback function as a parameter to asynchronous functions.

apowers313 commented 6 years ago

This warning still exists. It's line 236 of tcoll.js that's causing the depreciation warning because fs.close isn't passed a callback parameter:

fs.close(self._fd);