Registry / storage / fsos
library1.1.6jsnpmunverified

A file system object storage library for Node.js (v1.1.6, stable). Provides a simplified Promise-based interface for common object storage operations (set, get, delete) by treating keys as file paths and automatically creating directories. The library aims to stay close to the file system while ensuring consistency across crashes and multiple processes. It supports values as strings, Buffers, or JSON-serializable objects. Differentiators: minimal API, no external dependencies, and a focus on crash consistency over raw speed. Suitable for small-scale local storage needs.

npm install fsos
INSTALL
IMPORT
SIG · FSOS
F
fsos
storagejavascriptv1.1.6
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.

default
import fsos from 'fsos'
const fsos = require('fsos')
ESM default export; CommonJS require also works for Node < 12.
set
import { set } from 'fsos'
import { set as fsosSet } from 'fsos'
Named export also available, but default export is the typical usage.
get
import { get } from 'fsos'
const get = fsos.get
Named export works. Getting from default export is also fine.
delete
import { delete as del } from 'fsos'
import { remove } from 'fsos'
Export is named 'delete', which is a reserved word in ESM; use alias.

Shows basic usage: setting a JSON-serializable object at a key path, then reading it back.

import fsos from 'fsos'; const user = { nick: 'jade', firstName: 'Jackie', lastName: 'Dent' }; async function main() { await fsos.set('user/' + user.nick, JSON.stringify(user)); const value = await fsos.get('user/' + user.nick); console.log(value.toString()); } main().catch(console.error);
Debug
Known issues
gotchaFolders cannot contain data: if you set a key like 'foo/bar', you cannot later set a key 'foo' because 'foo' is a folder.
fix
Design key paths carefully to avoid conflicts between folders and files.
affects: >=0.0.0
gotchaValues are stored as files; be cautious with large files as they are read entirely into memory.
fix
Consider streaming for very large data; fsos is not designed for large files.
affects: >=0.0.0
gotchaThe get method returns a Buffer; you must call .toString() for string content.
fix
Use .toString() or convert to string via encoding parameter if needed.
affects: >=0.0.0
deprecatedNo known deprecations; library is minimal and stable.
fix
None.
affects: >=0.0.0
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open '...'
Trying to get a key that does not exist.
fix
Check if the key exists before calling get, or wrap in try/catch.
TypeError: The "path" argument must be of type string
Passing a non-string key to set/get/delete.
fix
Ensure the key is a string; use .toString() if needed.
Error: EISDIR: illegal operation on a directory, read
Trying to get a key that corresponds to a folder (e.g., after setting 'foo/bar', trying to get 'foo').
fix
Avoid using keys that are prefixes of other keys.
Upgrade
Version history
1.1.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
31 hits · last 30 days
node
28
Resources
packagefsos
fsos — npm install fsos · libregistry