| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- 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;
|