
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
Filter out OS junk files like
.DS_StoreandThumbs.db
$ npm install --save junk
var fs = require('fs');
var junk = require('junk');
fs.readdir('path', function (err, files) {
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.
The regex used for matching.
MIT © Sindre Sorhus
Similar to 'junk', the 'ignore' package is used to manage and filter files based on rules specified in a .gitignore file. While 'junk' specifically filters out system and hidden files, 'ignore' provides a more flexible approach allowing users to define custom patterns for what should be ignored.
The 'glob' package provides functionality to match file paths against specified patterns. Although it's not specifically for filtering out junk files, it can be configured to exclude certain patterns similar to junk files, offering a broader file filtering capability compared to 'junk'.
FAQs
Filter out system junk files like .DS_Store and Thumbs.db
The npm package junk receives a total of 2,664,293 weekly downloads. As such, junk popularity was classified as popular.
We found that junk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.