Skip to content

Commit

Permalink
merge v0.1.5 into stable (#11)
Browse files Browse the repository at this point in the history
* remove hard-coded functions names for `promisify` (#9)

* remove hard-coded functions names for `promisify`

* fixing eslint

* fix code style

* add atomics keyword, and bump to v0.1.5

* It requires Node.js 8.1.0 (#10)
  • Loading branch information
bdistin authored Jul 2, 2017
1 parent d11a846 commit ed4d696
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Node.js V8 native fs, enhanced with util.promisify and standard extra methods. W
Docs
------

All `fs` methods which return a callback, return a promise instead. All `fs-extra` methods return a promise exclusivly. No Sync methods are included from either `fs` or `fs-extra`. Requires minimum Node.js v8.0.0.
All `fs` methods which return a callback, return a promise instead. All `fs-extra` methods return a promise exclusivly. No Sync methods are included from either `fs` or `fs-extra`. Requires minimum Node.js v8.1.0.

Credit
------
Expand Down
15 changes: 1 addition & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,13 @@ const { promisify } = require('util');
const { randomBytes } = require('crypto');
const { tmpdir } = require('os');

const targets = [
'access', 'appendFile',
'chmod', 'chown', 'close',
'fchmod', 'fchown', 'fdatasync', 'fstat', 'fsync', 'ftruncate', 'futimes',
'lchmod', 'lchown', 'link', 'lstat',
'mkdir', 'mkdtemp',
'open',
'read', 'readdir', 'readFile', 'readlink', 'realpath', 'rename', 'rmdir',
'stat', 'symlink',
'truncate',
'unlink', 'utimes',
'write', 'writeFile'
];
const o777 = 0o0777;
const isWindows = process.platform === 'win32';
const setTimeoutPromise = promisify(setTimeout);

for (const [key, value] of Object.entries(fs)) {
if (key.includes('Sync')) continue;
if (targets.includes(key)) exports[key] = promisify(value);
if (`${key}Sync` in fs) exports[key] = promisify(value);
else exports[key] = value;
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "fs-nextra",
"version": "0.1.4",
"version": "0.1.5",
"description": "Node.js V8 native fs enhanced with util.promisify and standard extra methods.",
"main": "index.js",
"scripts": {
"test": "eslint index.js"
},
"keywords": [
"atomics",
"copy",
"delete",
"directory",
Expand Down

0 comments on commit ed4d696

Please sign in to comment.