node-all-files
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "node-all-files", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Few helpers to process all of the files in some folder", | ||
"main": "index.js", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "node test.js" | ||
"build": "BABEL_ENV=production babel --copy-files ./src --out-dir lib", | ||
"test": "node tests/test.js" | ||
}, | ||
@@ -21,3 +22,13 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/asci/all-files#readme" | ||
"homepage": "https://github.com/asci/all-files#readme", | ||
"devDependencies": { | ||
"babel": "^6.5.2", | ||
"babel-cli": "^6.22.2" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015", | ||
"stage-2" | ||
] | ||
} | ||
} |
# all-files | ||
Few helpers to process all of the files in some folder with promises | ||
Helpers to process files recursively in folder with promises | ||
## Prereq | ||
- node 6 | ||
- node 4 | ||
- \*nix, macOs | ||
@@ -11,5 +12,2 @@ ## How to install | ||
###### or from Github | ||
`npm install https://github.com/asci/all-files` | ||
## How to use | ||
@@ -24,7 +22,7 @@ ### getFilenames | ||
// Supports RegExp, String and Function for filtering: | ||
getFilenames(root, /\.js$/i); | ||
getFilenames(folder, /\.js$/i); | ||
//or | ||
getFilenames(root, '.js'); | ||
getFilenames(folder, '.js'); | ||
//or | ||
getFilenames(root, (f) => ~f.indexOf('.js')) | ||
getFilenames(folder, (f) => ~f.indexOf('.js')) | ||
.then(({ files }) => { | ||
@@ -42,4 +40,6 @@ console.log(files); | ||
processFiles(files, (buff) => { | ||
processFiles(files, (buff, filename) => { | ||
console.log(buff.toString().length); | ||
}).then(() => { | ||
console.log('All files were processed'); | ||
}); | ||
@@ -46,0 +46,0 @@ |
Sorry, the diff of this file is not supported yet
5479
8
77
2
2