You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

56 lines
1.0 KiB

const promisify = require('./promisify');
const root = require('./root');
const each = require('./each');
const toArr = require('./toArr');
const fs = require('fs');
each(
[
'access',
'appendFile',
'chmod',
'chown',
'close',
'fchmod',
'fchown',
'fdatasync',
'fstat',
'fsync',
'ftruncate',
'futimes',
'link',
'lstat',
'mkdir',
'mkdtemp',
'open',
'read',
'readFile',
'readdir',
'readlink',
'realpath',
'rename',
'rmdir',
'stat',
'symlink',
'truncate',
'unlink',
'utimes',
'write',
'writeFile'
],
function(method) {
exports[method] = promisify(fs[method]);
}
);
exports.exists = function() {
const args = toArr(arguments);
return new root.Promise(function(resolve) {
args.push(resolve);
fs.exists.apply(null, args);
});
};
module.exports = exports;