{"id":45599,"library":"node-ts-cache-storage-node-fs","title":"node-ts-cache-storage-node-fs","description":"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.","status":"active","version":"4.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/havsar/node-ts-cache","tags":["javascript","node","nodejs","cache","typescript","ts","caching","memcache","memory-cache"],"install":[{"cmd":"npm install node-ts-cache-storage-node-fs","lang":"bash","label":"npm"},{"cmd":"yarn add node-ts-cache-storage-node-fs","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-ts-cache-storage-node-fs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; the cache container is defined by this library","package":"node-ts-cache","optional":false}],"imports":[{"note":"Named export only; default import is not available.","wrong":"import NodeFsStorage from 'node-ts-cache-storage-node-fs'","symbol":"NodeFsStorage","correct":"import { NodeFsStorage } from 'node-ts-cache-storage-node-fs'"},{"note":"CacheContainer is from node-ts-cache, not from this package.","wrong":"import { CacheContainer } from 'node-ts-cache-storage-node-fs'","symbol":"CacheContainer","correct":"import { CacheContainer } from 'node-ts-cache'"},{"note":"The Cache decorator is exported by node-ts-cache.","wrong":"import { Cache } from 'node-ts-cache-storage-node-fs'","symbol":"Cache decorator","correct":"import { Cache } from 'node-ts-cache'"}],"quickstart":{"code":"import { Cache, CacheContainer } from 'node-ts-cache';\nimport { NodeFsStorage } from 'node-ts-cache-storage-node-fs';\n\nconst userCache = new CacheContainer(new NodeFsStorage());\n\nclass MyService {\n    @Cache(userCache, { ttl: 60 })\n    public async getUsers(): Promise<string[]> {\n        return ['Max', 'User'];\n    }\n}\n\nconst service = new MyService();\nconsole.log(await service.getUsers());","lang":"typescript","description":"Shows how to create a filesystem-backed cache and use it with the Cache decorator on a method."},"warnings":[{"fix":"Use node-ts-cache@5 or downgrade to node-ts-cache-storage-node-fs@3.x.","message":"node-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.","severity":"breaking","affected_versions":">=4.0.0 <5.0.0"},{"fix":"Specify a custom base path in constructor options.","message":"Cache files are stored in the system's temporary directory by default; may cause unexpected eviction across restarts.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use `basePath` instead of `path` in constructor options.","message":"The old `path` option was renamed to `basePath` in v3.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Add 'experimentalDecorators: true' and 'emitDecoratorMetadata: true' to tsconfig.json.","message":"Ensure your project uses TypeScript's experimentalDecorators: true and emitDecoratorMetadata: true in tsconfig.json for the @Cache decorator to work.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'4.4.0':21 'adapt':11 'backend':33,51 'base':58 'cach':4,17,18,27,32,44,59,67,88,93,96,100 'cadenc':80 'configur':65 'default':78 'directori':76 'file':37,68 'filesystem':9 'fs':7 'in-memori':46 'irregular':82 'javascript':90 'librari':19 'local':36 'memcach':97 'memori':48,57,99 'memory-bas':56 'memory-cach':98 'minim':64 'node':2,6,15,25,86,91 'node-ts-cach':14,24,85 'node-ts-cache-storage-node-f':1 'node.js':8 'nodej':92 'persist':31 'process':62 'provid':29 'redi':50 'releas':79 'requir':66 'restart':63 'server':42 'server-sid':41 'side':43 'storag':5,10 'store':70 'suitabl':54 'surviv':61 'system':38,73 'temporari':75 'tie':83 'ts':3,16,26,87,95 'typescript':94 'unlik':55 'updat':89 'use':34,39 'v5':28 'version':20 'work':22","created_at":"2026-06-07T12:55:48.505395+00:00","updated_at":"2026-06-07T12:55:48.505395+00:00","problems":[{"fix":"Ensure both packages are compatible versions (node-ts-cache-storage-node-fs@4.x with node-ts-cache@5.x).","cause":"Mismatched versions of node-ts-cache-storage-node-fs and node-ts-cache.","error":"TypeError: node_ts_cache_storage_node_fs_1.NodeFsStorage is not a constructor"},{"fix":"Install node-ts-cache: npm install node-ts-cache","cause":"Missing peer dependency node-ts-cache.","error":"Cannot find module 'node-ts-cache' or its corresponding type declarations."},{"fix":"Add \"experimentalDecorators\": true and \"emitDecoratorMetadata\": true to tsconfig.json.","cause":"TypeScript decorators are experimental and require the compiler option.","error":"Experimental support for decorators is a feature that might change in a future release"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/havsar/node-ts-cache#readme","github":"https://github.com/havsar/node-ts-cache","docs":null,"changelog":null,"pypi":null,"npm":"node-ts-cache-storage-node-fs","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}