Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'rename',
'rmdir',
'stat',
'symlink',
'truncate',
'unlink',
'utimes',
'write',
'writeFile'
]
typeof fs.access === 'function' && api.push('access')
typeof fs.copyFile === 'function' && api.push('copyFile')
typeof fs.mkdtemp === 'function' && api.push('mkdtemp')
require('thenify-all').withCallback(fs, exports, api)
exports.exists = function (filename, callback) {
// callback
if (typeof callback === 'function') {
return fs.stat(filename, function (err) {
callback(null, !err);
})
}
// or promise
return new Promise(function (resolve) {
fs.stat(filename, function (err) {
resolve(!err)
})
})
}
};
// http://www.elasticsearch.org/guide/reference/api/admin-cluster-update-settings/
self.updateSettings = function (options, data, callback) {
if (!callback && typeof data === 'function') {
callback = data;
data = options;
options = {};
}
options.pathname = utils.pathAppend('_cluster/settings');
return req.put(options, data, callback);
};
return thenifyAll.withCallback(self, {});
};
'outputFile',
'outputJson',
'readJson',
'remove',
'writeJson',
// aliases
'createFile',
'createLink',
'createSymlink',
'emptydir',
'mkdirp',
'readJSON',
'outputJSON',
'writeJSON'
]
thenifyAll.withCallback(fsExtra, exports, fsExtraKeys)
// Delegate all normal fs to mz/fs
// (this overwrites anything proxies directly above)
var mzKeys = [
'rename',
'ftruncate',
'chown',
'fchown',
'lchown',
'chmod',
'fchmod',
'stat',
'lstat',
'fstat',
'link',
'symlink',
require('thenify-all').withCallback(
require('child_process'),
exports, [
'exec',
'execFile',
]
)
require('thenify-all').withCallback(
require('crypto'),
exports, [
'pbkdf2',
'pseudoRandomBytes',
'randomBytes'
]
)
require('thenify-all').withCallback(
require('crypto'),
exports, [
'pbkdf2',
'pseudoRandomBytes',
'randomBytes'
]
)
require('thenify-all').withCallback(
require('child_process'),
exports, [
'exec',
'execFile',
]
)
require('thenify-all').withCallback(
require('dns'),
exports, [
'lookup',
'resolve',
'resolve4',
'resolve6',
'resolveCname',
'resolveMx',
'resolveNs',
'resolveSrv',
'resolveTxt',
'reverse'
]
)
require('thenify-all').withCallback(
require('zlib'),
exports, [
'deflate',
'deflateRaw',
'gzip',
'gunzip',
'inflate',
'inflateRaw',
'unzip',
]
)
require('thenify-all').withCallback(
require('dns'),
exports, [
'lookup',
'resolve',
'resolve4',
'resolve6',
'resolveCname',
'resolveMx',
'resolveNs',
'resolveSrv',
'resolveTxt',
'reverse'
]
)