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