
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
directory-cache
Advanced tools
A directory cache, built on top of DirectoryWatcher. The cache reads all the files in a directory and caches their content. When files are changed, added, deleted etc the cache will update and fire an event using the good old EventEmitter API.
npm install directory-cache
var DirectoryCache = require('directory-cache');
var cache = DirectoryCache.create({
directory: '/path/to/the/moon'
}/*, optionally supply a callback to automatically call .init */);
cache.on('add', function(files) {
var content = cache.getFileContent(files[0]);
// do something with content
});
cache.on('change', function(files) {
// etc...
});
cache.on('delete', function(files) {
// etc..
});
cache.on('error', function(err) {
// waaaaaaaaah!
})
cache.init(function(err) {
if (err)
return console.log('ahhhhhhhhhhhh!', err);
var content = cache.getFileContent('moo.txt'); // returns the content of /path/to/the/moon/moo.txt
var files = cache.getFiles(); // returns all the files in /path/to/the/moon
});
// regular expression retains only json files
var DirectoryCache = require('directory-cache');
var cache = DirectoryCache.create({
directory: '/path/to/the/moon',
filter: /.*json/
});
// function filter that retains only json files
var cache2 = DirectoryCache.create({
directory: '/path/to/the/moon',
filter: function(file) { return file.slice(-5).toLowerCase() === '.json' }
});
FAQs
A directory cache + watch util
We found that directory-cache 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
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.