read-cache

JSON →
library 1.0.0 ·javascript
verified Jun 7, 2026

Minimalistic library (v1.0.0, stable) that reads a file into memory and caches its contents, invalidating the cache when the file's modification time changes. Returns promises (async) and offers sync variants. No dependencies, ESM/CJS compatible. Key differentiator: automatic cache invalidation via stat() on every read, avoiding stale data without explicit TTL or watchers. Suitable for small config files or one-shot reads where performance is not critical.