Registry / database / node-ts-cache-storage-node-fs

node-ts-cache-storage-node-fs

JSON →
library4.4.0jsnpmunverified

Node.js filesystem storage adapter for the node-ts-cache caching library. Version 4.4.0 works with node-ts-cache v5+. Provides a persistent cache backend using the local file system, useful for server-side caching where in-memory or Redis backends are not suitable. Unlike memory-based caches, it survives process restarts. Minimal configuration required; cache files are stored under the system's temporary directory by default. Release cadence is irregular, tied to node-ts-cache updates.

npm install node-ts-cache-storage-node-fs
INSTALL
IMPORT
SIG · NODE-TS-CACHE-STOR
N
node-ts-cache-storage-node-fs
databasejavascriptv4.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

NodeFsStorage
import { NodeFsStorage } from 'node-ts-cache-storage-node-fs'
import NodeFsStorage from 'node-ts-cache-storage-node-fs'
Named export only; default import is not available.
CacheContainer
import { CacheContainer } from 'node-ts-cache'
import { CacheContainer } from 'node-ts-cache-storage-node-fs'
CacheContainer is from node-ts-cache, not from this package.
Cache decorator
import { Cache } from 'node-ts-cache'
import { Cache } from 'node-ts-cache-storage-node-fs'
The Cache decorator is exported by node-ts-cache.

Shows how to create a filesystem-backed cache and use it with the Cache decorator on a method.

import { Cache, CacheContainer } from 'node-ts-cache'; import { NodeFsStorage } from 'node-ts-cache-storage-node-fs'; const userCache = new CacheContainer(new NodeFsStorage()); class MyService { @Cache(userCache, { ttl: 60 }) public async getUsers(): Promise<string[]> { return ['Max', 'User']; } } const service = new MyService(); console.log(await service.getUsers());
Debug
Known issues
breakingnode-ts-cache-storage-node-fs v4.x requires node-ts-cache v5.x. v5 of node-ts-cache changed the Cache decorator and CacheContainer API.
fix
Use node-ts-cache@5 or downgrade to node-ts-cache-storage-node-fs@3.x.
affects: >=4.0.0 <5.0.0
breakingCache files are stored in the system's temporary directory by default; may cause unexpected eviction across restarts.
fix
Specify a custom base path in constructor options.
affects: >=1.0.0
deprecatedThe old `path` option was renamed to `basePath` in v3.
fix
Use `basePath` instead of `path` in constructor options.
affects: >=3.0.0
gotchaEnsure your project uses TypeScript's experimentalDecorators: true and emitDecoratorMetadata: true in tsconfig.json for the @Cache decorator to work.
fix
Add 'experimentalDecorators: true' and 'emitDecoratorMetadata: true' to tsconfig.json.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: node_ts_cache_storage_node_fs_1.NodeFsStorage is not a constructor
Mismatched versions of node-ts-cache-storage-node-fs and node-ts-cache.
fix
Ensure both packages are compatible versions (node-ts-cache-storage-node-fs@4.x with node-ts-cache@5.x).
Cannot find module 'node-ts-cache' or its corresponding type declarations.
Missing peer dependency node-ts-cache.
fix
Install node-ts-cache: npm install node-ts-cache
Experimental support for decorators is a feature that might change in a future release
TypeScript decorators are experimental and require the compiler option.
fix
Add "experimentalDecorators": true and "emitDecoratorMetadata": true to tsconfig.json.
Upgrade
Version history
4.4.0latest on npm
Audit
Dependencies
node-ts-cacherequiredpeer dependency; the cache container is defined by this library
Agent activity
2 hits · last 30 days
node
2
Resources
node-ts-cache-storage-node-fs — npm install node-ts-cache-storage-node-fs · libregistry