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
197 Stars 16 Forks MIT License 47 Commits 0 Opened issues

Description

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

Services available

!
?

Need anything else?

Contributors list

# 221
exec
test-fr...
nextjs
messeng...
37 commits
# 5,605
TypeScr...
typescr...
iterm2
exec
2 commits
# 123,560
TypeScr...
Shell
fp-ts
schema-...
1 commit
# 3,028
IPFS
exec
React
alfred
1 commit
# 240
JavaScr...
bittorr...
torrent
ecmascr...
1 commit
# 24,045
Angular
bittorr...
Electro...
webrtc
1 commit
# 6,604
chalk
exec
vuejs2
sketch-...
1 commit

junk

Filter out system junk files like

.DS_Store
and
Thumbs.db

Install

$ npm install junk

Usage

import fs from 'node:fs/promises';
import {isNotJunk} from 'junk';

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

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

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

API

isJunk(filename)

Returns

true
if
filename
matches a junk file.

isNotJunk(filename)

Returns

true
if
filename
does not match a junk file.

junkRegex

Regex used for matching junk files.

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.