junk
Filter out system junk files like .DS_Store and Thumbs.db
Last updated 2 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install junk 
SYNC missed versions from official npm registry.

junk Build Status

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

Install

$ npm install --save junk

Usage

const fs = require('fs');
const junk = require('junk');

fs.readdir('some/path', (err, files) => {
	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.

License

MIT © Sindre Sorhus

Maintainers (1)
Downloads
Today 82
This Week 124
This Month 2,815
Last Day 42
Last Week 1,269
Last Month 5,031
Dependencies (0)
None
Dev Dependencies (2)

Copyright 2014 - 2018 © taobao.org |