Gathering detailed insights and metrics for file-system-cache
Gathering detailed insights and metrics for file-system-cache
Gathering detailed insights and metrics for file-system-cache
Gathering detailed insights and metrics for file-system-cache
flat-cache
A simple key/value storage using files to persist the data
@parcel/cache
Interface for defining caches and file-system, IDB and LMDB implementations.
cache
Simple caching object with optional TTL and file system persistence.
cache-manager-fs-hash
file system store for node cache manager
A super-fast, promise based cache that reads and writes to the file-system.
npm install file-system-cache
Typescript
Module System
Node Version
NPM Version
98.8
Supply Chain
99.5
Quality
82.6
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
1,019,043,342
Last Day
822,325
Last Week
3,905,347
Last Month
15,941,010
Last Year
235,126,686
MIT License
64 Stars
97 Commits
15 Forks
3 Watchers
3 Branches
11 Contributors
Updated on Apr 13, 2025
Minified
Minified + Gzipped
Latest Version
3.0.0-alpha.8
Package Id
file-system-cache@3.0.0-alpha.8
Unpacked Size
735.23 kB
Size
173.84 kB
File Count
6
NPM Version
10.7.0
Node Version
22.1.0
Published on
Aug 26, 2024
Cumulative downloads
Total Downloads
Last Day
10.9%
822,325
Compared to previous day
Last Week
18.3%
3,905,347
Compared to previous week
Last Month
-3.5%
15,941,010
Compared to previous month
Last Year
-19.2%
235,126,686
Compared to previous year
A super-fast, promise-based cache that reads and writes to the file-system.
npm install --save file-system-cache
Import
1import Cache from 'file-system-cache'; 2 3 // or ↑↓ (equivalent) 4 5import { Cache } from 'file-system-cache';
Create an instance of the cache optionally giving it a folder location to store files within.
1import Cache from "file-system-cache"; 2 3const cache = Cache({ 4 basePath: "./.cache", // (optional) Path where cache files are stored (default). 5 ns: "my-namespace", // (optional) A grouping namespace for items. 6 hash: "sha1", // (optional) A hashing algorithm used within the cache key. 7 ttl: 60, // (optional) A time-to-live (in secs) on how long an item remains cached. 8});
Reference
default
for CommonJS, e.g:const Cache = require('file-system-cache').default
The optional ns
("namespace") allows for multiple groupings of files to reside within the one cache folder. When you have multiple caches with different namespaces you can re-use the same keys and they will not collide.
The optional ttl
("time to live") allows you to set a default expiration for the cache key, in seconds. For example if you
set this value to 60 then cache hits to any cache key made beyond the limit of that 60 seconds will result in cache misses.
Retrieves the contents of a cached file.
1cache.get("foo") 2 .then(result => /* Success */) 3 .catch(err => /* Fail */);
or use modern async/await
syntactic sugar of course:
1const value = await cache.get("foo");
Use getSync
for a synchronous version.
Pass a defaultValue
parameter to use if the key does not exist within the cache.
Write a value to the cache.
1/* This will apply the default TTL to this cache key */ 2cache.set("foo", "...value...") 3 .then(result => /* Success */) 4 5/* This will set a specific TTL for this cache key */ 6cache.set("bar", "...baz", 60) 7 .then(result => /* Success */)
Value types are stored and respected on subsequent calls to get
. For examples, passing in Object will return that in its parsed object state.
Use setSync
for a synchronous version.
Deletes the specified cache item from the file-system.
1cache.remove("foo") 2 .then(() => /* Removed */)
Clears all cached items from the file-system.
1cache.clear() 2 .then(() => /* All items deleted */)
Saves (sets) several items to the cache in one operation.
1cache.save([{ key:"one", value:"hello" }, { key:"two", value:222 }]) 2 .then(result => /* All items saved. */)
Loads all files within the cache's namespace.
1cache.load() 2 .then(result => /* The complete of cached files (for the ns). */)
# Run tests.
npm test
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
Found 6/27 approved changesets -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
15 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More