Asynchronous cache for ArrayBuffers with TypeScript support. Current stable version is 4.0.121. Provides a simple, non-blocking interface for caching binary data. Alternates like lru-cache or node-cache are synchronous and not optimized for ArrayBuffers. This package is dependency-free and ships bundled TypeScript definitions.
npm install array-buffer-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a cache instance with a 1GB limit, stores and retrieves an ArrayBuffer asynchronously.
Copy the buffer manually if needed: const copy = buffer.slice(0);
Implement periodic cleanup using setInterval if time-based expiry is required.
Update new ArrayBufferCache() to new ArrayBufferCache({}) or provide options.Clone after retrieval if mutation is expected.
Use cache.stats().entryCount
Use named import: import { ArrayBufferCache } from 'array-buffer-cache'Run npm install array-buffer-cache
Check for undefined before accessing properties: const cached = await cache.get(key); if (cached) { console.log(cached.byteLength); }Ensure the value is an ArrayBuffer: cache.set(key, new ArrayBuffer(data.byteLength))
No dependency data recorded yet.