Sha256: ad1ff87733d537113add454a02a0f679f3132d6acad15d739393bd62dadee7c2
Contents?: true
Size: 851 Bytes
Versions: 62
Compression:
Stored size: 851 Bytes
Contents
var fs = require('graceful-fs'); var readdir = fs.readdir.bind(fs); var readdirSync = fs.readdirSync.bind(fs); module.exports = fs; module.exports.readdir = function (dir, callback) { fs.stat(dir, function (err, stats) { if (err) return callback(err); if (stats.isDirectory()) { return readdir(dir, callback); } else { var error = new Error('ENOTDIR, not a directory \'' + dir + '\''); error.code = 'ENOTDIR'; error.path = dir; error.errono = -20; return callback(error); } }); }; module.exports.readdirSync = function (dir) { var stats = fs.statSync(dir); if (stats.isDirectory()) { return readdirSync(dir); } else { var error = new Error(); error.code = 'ENOTDIR'; throw error; } };
Version data entries
62 entries across 62 versions & 1 rubygems