junk

by sindresorhus

sindresorhus / junk

Filter out OS junk files like .DS_Store and Thumbs.db

129 Stars 10 Forks Last release: over 1 year ago (v3.1.0) MIT License 42 Commits 13 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

junk Build Status

Filter out system junk files like

.DS_Store
and
Thumbs.db

Install

$ npm install junk

Usage

const {promises: fs} = require('fs');
const junk = require('junk');

(async () => { const files = await fs.readdir('some/path');

console.log(files);
//=> ['.DS_Store', 'test.jpg']

console.log(files.filter(junk.not));
//=> ['test.jpg']

})();

API

junk.is(filename)

Returns

true
if
filename
matches a junk file.

junk.not(filename)

Returns

true
if
filename
doesn't match a junk file.

junk.regex

Regex used for matching junk files.

License

MIT © Sindre Sorhus

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.