1.1.3 • Published 7 years ago
fsstatwithpath v1.1.3
fsstatwithpath
fs.stat With Path Included To Callback Result
Installation
$ npm install fsstatwithpath
or
$ yarn add fsstatwithpath
Usage
Directory
var fswp = require("fsstatwithpath");
fswp("node_modules", (err, stats) => {
if (err) {
console.log("directory (error) => [" + err.code + "] " + err.path);
}
else {
console.log("directory (success) => " + stats.path);
}
});
fswp("xnode_modules", (err, stats) => {
if (err) {
console.log("directory (error) => [" + err.code + "] " + err.path);
}
else {
console.log("directory (success) => " + stats.path);
}
});
// OUTPUT
// directory (success) => node_modules
// directory (error) => [ENOENT] xnode_modules
File
var fswp = require("fsstatwithpath");
fswp("package.json", (err, stats) => {
if (err) {
console.log("file (error) => [" + err.code + "] " + err.path);
}
else {
console.log("file (success) => " + stats.path);
}
});
fswp("xpackage.json", (err, stats) => {
if (err) {
console.log("file (error) => [" + err.code + "] " + err.path);
}
else {
console.log("file (success) => " + stats.path);
}
});
// OUTPUT
// file (success) => package.json
// file (error) => [ENOENT] xpackage.json
Tests
$ npm test
or
$ yarn test