Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

file-entry-cache

Package Overview
Dependencies
Maintainers
0
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-entry-cache

A lightweight cache for file metadata, ideal for processes that work on a specific set of files and only need to reprocess files that have changed since the last run

  • 10.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
42M
decreased by-0.51%
Maintainers
0
Weekly downloads
 
Created

What is file-entry-cache?

The file-entry-cache npm package provides a simple way to cache the metadata of files in a directory. It is primarily used to speed up file processing tasks by caching the results of expensive file operations. This can be particularly useful in tasks like linting, where files that have not changed since the last run can be skipped. The package allows for creating, reading, and updating caches, and it can work with both flat file caches and more complex, structured data.

What are file-entry-cache's main functionalities?

Create and manage a file cache

This feature allows you to create a new cache or load an existing one from disk. You can add or remove files from the cache and save the updated cache back to disk. This is useful for tracking which files have been processed and which have not.

const fileEntryCache = require('file-entry-cache');
const cache = fileEntryCache.create('.myCache');
// To add a file to the cache
cache.addEntry('path/to/file.js');
// To remove a file from the cache
cache.removeEntry('path/to/file.js');
// To save the cache to disk
cache.reconcile();

Check if a file has changed since last cached

This feature allows you to check if a file has been modified since it was last added to the cache. This is particularly useful for tools that perform operations on files and want to skip processing for files that have not changed.

const fileEntryCache = require('file-entry-cache');
const cache = fileEntryCache.create('.myCache');
// Assuming 'path/to/file.js' was previously added to the cache
const fileHasChanged = cache.hasFileChanged('path/to/file.js');
if (fileHasChanged) {
  console.log('File has changed since last cache.');
} else {
  console.log('File has not changed.');
}

Other packages similar to file-entry-cache

Keywords

FAQs

Package last updated on 24 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc