0.0.9 • Published 10 months ago

@justinmusti/storage v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@justinmusti/storage

This is a platform-agnostic storage utility class.

Supported environments: Node Browser

How to Use

import

import {Storage} from "@justinmusti/storage"

Init

// Browser
const storage = new Storage()

// Node
const storage = new Storage({path: "path-to-file-to-write-to"})

Create entry in storage

storage.set("test", "hello")
// Browser: localStorage now has `test` entry with value 'hello'
// Node: file at provided path now has `test` entry with value 'hello'

Check if storage has key

storage.has('uploadURL') // returns true or false

Delete key from storage.

storage.removeitem('test')
storage.has('test')  // Now this returns false.

Remove all/Clear

storage.clear()
// All entries are removed.
0.0.9

10 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.8

10 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.1

11 months ago