Comparing version 0.0.4 to 0.0.5
37
index.js
@@ -60,14 +60,2 @@ /* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. | ||
my_fs.readdir = dirname => promise_wrapper((resolve, reject) => { | ||
fs.readdir(dirname, (err, files) => err ? reject(err) : resolve(files)); | ||
}); | ||
my_fs.mkdir = (dirpath, options = {}) => promise_wrapper((resolve, reject) => { | ||
fs.mkdir(dirpath, options, err => err ? reject(err) : resolve()); | ||
}); | ||
my_fs.ensure_dir = dirpath => async_wrapper(async () => { | ||
await fs.mkdir(dirpath, {recursive: true}); | ||
}); | ||
my_fs.readFile = (filepath, options) => promise_wrapper((resolve, reject) => { | ||
@@ -158,6 +146,27 @@ fs.readFile( | ||
my_fs.remove_dir = async_wrapper(async dirname => { | ||
if (await my_fs.exists(dirname)) return _rmdir(dirname); | ||
my_fs.readdir = dirname => promise_wrapper((resolve, reject) => { | ||
fs.readdir(dirname, (err, files) => err ? reject(err) : resolve(files)); | ||
}); | ||
my_fs.mkdir = (dirpath, options = {}) => promise_wrapper((resolve, reject) => { | ||
fs.mkdir(dirpath, options, err => err ? reject(err) : resolve()); | ||
}); | ||
my_fs.remove_dir = async_wrapper(async dirpath => { | ||
try { | ||
const stat = await my_fs.stat(dirpath); | ||
if (stat.isDirectory()) { | ||
await _rmdir(dirpath); | ||
} else { | ||
throw new Error(`dirpath: '${dirpath}' is not a directory`); | ||
} | ||
} catch (e) { | ||
if (e.code !== "ENOENT") throw e; | ||
} | ||
}); | ||
my_fs.ensure_dir = dirpath => async_wrapper(async () => { | ||
await fs.mkdir(dirpath, {recursive: true}); | ||
}); | ||
my_fs.remove = filepath => promise_wrapper((resolve, reject) => { | ||
@@ -164,0 +173,0 @@ fs.stat(filepath, async (err, stats) => { |
{ | ||
"name": "@jeefo/fs", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"homepage": "https://github.com/je3f0o/fs", | ||
@@ -5,0 +5,0 @@ "copyright": "2020", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7799
157