Registry / storage / storage-core

storage-core

JSON →
library0.7.2jsnpmunverified

Provides a minimal Storage interface and a local filesystem implementation for Node.js, enabling dynamic storage switching. Version 0.7.2 is stable, with slow release cadence (last update 2022). Key differentiator: abstract base class that third-party packages (AWS S3, Azure Blob, GCP) implement, making it easy to swap storage backends without changing application code. Ships TypeScript types for type safety.

npm install storage-core
INSTALL
IMPORT
SIG · STORAGE-CORE
S
storage-core
storagejavascriptv0.7.2
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.

Storage
import { Storage } from 'storage-core'
import Storage from 'storage-core'
The Storage class is a named export, not a default export.
LocalStorage
import { LocalStorage } from 'storage-core'
import { Local } from 'storage-core'
The concrete implementation is named LocalStorage, not Local.
types (e.g. DiskOptions)
import type { DiskOptions } from 'storage-core'
Use import type for TypeScript type-only imports to avoid runtime overhead.

Shows how to instantiate LocalStorage, write, read, delete, and check file existence.

import { LocalStorage, Storage } from 'storage-core'; import { join } from 'path'; // Create adapter const storage = new LocalStorage({ root: join(process.cwd(), '.data') }); // Write file await storage.write('hello.txt', 'world'); // Read file const content = await storage.read('hello.txt'); console.log(content.toString()); // world // Delete file await storage.delete('hello.txt'); // Check existence console.log(await storage.exists('hello.txt')); // false
Debug
Known issues
breakingStorage class methods changed signatures between 0.6.x and 0.7.x.
fix
Update your implementation to match the new interface: `read()` now returns Buffer | undefined instead of string.
affects: >=0.7.0
deprecatedThe `existsSync` method is deprecated in 0.7.x.
fix
Use the async `exists()` method instead.
affects: >=0.7.0
gotchaLocalStorage `root` option must be an absolute path.
fix
Use path.resolve() or path.join with process.cwd() to resolve an absolute path.
gotcha`read()` returns `Buffer | undefined`; you must check for undefined before using.
fix
Add a null-check: `const data = await storage.read('file'); if (!data) throw new Error('Not found');`
affects: >=0.7.0
Errors
Common errors & fixes
Cannot find module 'storage-core' or its corresponding type declarations.
Missing npm install or TypeScript ESM resolution issue.
fix
Run `npm install storage-core`. If using TypeScript, ensure `moduleResolution` is set to `node16` or `bundler`.
TypeError: storage.write is not a function
Using an old version (<0.7.0) where the method was named differently.
fix
Upgrade to >=0.7.0 or check the API: earlier versions used `upload()` and `download()`.
Error: ENOENT: no such file or directory, mkdir '...'
The parent directory for LocalStorage root does not exist.
fix
Create the directory manually or use `mkdirSync` with `recursive: true` before constructing LocalStorage.
Upgrade
Version history
0.7.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
27 hits · last 30 days
node
24
Amazon
1
OpenAI (training)
1
Resources
storage-core — npm install storage-core · libregistry