Need help with junk?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

sindresorhus
134 Stars 11 Forks MIT License 44 Commits 0 Opened issues

Description

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

Services available

!
?

Need anything else?

Contributors list

# 207
node
exec
test-fr...
nextjs
34 commits
# 7,468
TypeScr...
typescr...
iterm2
Node.js
2 commits
# 309,189
algebra...
Shell
HTML
fp-ts
1 commit
# 2,562
IPFS
exec
React
vanilla...
1 commit
# 212
JavaScr...
bittorr...
torrent
ecmascr...
1 commit
# 20,691
Angular
bittorr...
Electro...
webrtc
1 commit
# 6,447
chalk
Svelte
example...
Ada
1 commit

junk

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.