
Company News
Andrew Becherer Joins Socket as Chief Information Security Officer
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.
@eds-fw/storage
Advanced tools
Tiny & Simply 'Map'/'Array'-based storage with .save() method
save() (protection from multi-saving)day ${number} (day 6, day 293, day 32, etc., but not hour 7)hasValue(), getKey(), filter() & easy JSON convertionStorage <V? extends JSONSupported, K? extends string> default export
- extends Map<K, V>
- constructor
(path: string, autosave?: boolean | number)- field
path: stringhasValue (value: V): booleangetKey (value: V, single?: boolean): K[]filter (callbackfn: (value: V, key: K, map: Map<K, V>) => boolean): Map<K, V>- async
save (): Promise<void>- getter
asJSON: string[Symbol.toStringTag]: string- static
create <V? extends JSONSupported, K? extends string> (...params: ConstructorParameters<typeof Storage>): Storage<V, K>- static
asJSON (map: Map<string, JSONSupported>): string- static field
oneFile_oneStorage: boolean
ArrayStorage <V? extends JSONSupported>
- extends Array<V>
- private constructor
()- field
path: string- async
save (): Promise<void>- getter
asJSON: string[Symbol.toStringTag]: string- static
create <V? extends JSONSupported> (path: string, autosave?: boolean | number): ArrayStorage<V>- static
asJSON (arr: JSONSupported[]): string- static field
oneFile_oneStorage: boolean
v18 or newerstorage via npm:npm i @eds-fw/storage
storage://file.js, type: CJS
const { Storage } = require("@eds-fw/storage");
const scores = new Storage(
"./scores_data.json", //Warning! Path is calculated from CWD
60_000 //Autosave timeout. Will be saved automatically every minute
);
scores.set("me", 186);
scores.save();
scores.set("john", 231);
if (storage.has("peter"))
storage.delete("peter");
console.log(storage.asJSON());
/* Output (pretty):
{
"me": 186,
"john": 231
}
*/
Or, using TypeScript and "exact key types":
//file.ts
import { Storage } from "@eds-fw/storage";
type Keys_t = `score_${string}` | `bestScore_${string}`;
const scores = new Storage<number, Keys_t>(
"./scores.json",
60_000
);
scores.set("score_me", 132); //OK
scores.set("score_john", 452); //OK
scores.set("bestScore_me", 972); //OK
scores.set("previousScore_me", 274); //TypeScript Error
FAQs
Tiny & Simply 'Map'-based storage: set(), get(), save() and more
The npm package @eds-fw/storage receives a total of 17 weekly downloads. As such, @eds-fw/storage popularity was classified as not popular.
We found that @eds-fw/storage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.