Micro-cache (v3.0.3) is a minimal synchronous file system cache for Node.js. It writes/reads files to a local directory synchronously, with no runtime memory caching. Designed for simplicity, it uses the file system exclusively, not memory. The package is ES module (no CommonJS), requires Node >=12, and has no dependencies. It is a niche tool for scenarios requiring a persistent, synchronous, file-based cache with minimal overhead.
npm install micro-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic synchronous file cache operations: write, read, delete, and conditional write. The cache persists to disk.
Use import (ESM) or dynamic import; or downgrade to version 2.x if CommonJS is required.
Use cache.read(key) !== undefined to test existence.
Only use in scripts or for small caches; avoid in high-concurrency production servers.
Sanitize keys (e.g., replace / with -) or use a hashing function.
Add 'type': 'module' to package.json or use .mjs extension, or downgrade to micro-cache@2.x.
Use import MicroCache from 'micro-cache' or const { default: MicroCache } = require('micro-cache').Ensure the cache directory exists before instantiation (e.g., fs.mkdirSync('./cache', { recursive: true })).No dependency data recorded yet.