Muqriz 48f16bfc3e initail first | 4 months ago | |
---|---|---|
.. | ||
index.d.ts | 4 months ago | |
index.js | 4 months ago | |
license | 4 months ago | |
package.json | 4 months ago | |
readme.md | 4 months ago |
Filter out system junk files like
.DS_Store
andThumbs.db
$ npm install junk
const {promisify} = require('util');
const fs = require('fs');
const junk = require('junk');
const pReaddir = promisify(fs.readdir);
(async () => {
const files = await pReaddir('some/path');
console.log(files);
//=> ['.DS_Store', 'test.jpg']
console.log(files.filter(junk.not));
//=> ['test.jpg']
})();
Returns true
if filename
matches a junk file.
Returns true
if filename
doesn’t match a junk file.
Regex used for matching junk files.
MIT © Sindre Sorhus