@leofcoin/storage v3.5.28
LeofcoinStorage
install
npm i @leofcoin/storage
breaking changes
Usage
import LeofcoinStorage from '@leofcoin/storage'
const storage = new LeofcoinStorage(name, root)
await storage.init()
// stores/returns a value as uint8Array
await storage.put('hello', 'world')
(await storage.get('hello')).toString() // world
await storage.get() // [{ key: 'hello', value: 'world'}]
await storage.has('hello') // true
await storage.size() // 4
await storage.delete('hello') // bye world
API
options
name: store name root: root directory
new LeofcoinStorage(name, root)
methods
get
key: path/filename returns: Promise()<uint8Array>
storage.get(key)
const all = storage.get()
console.log(all) // [{key,value}]
put
key: path/filename value: path/filename returns: Promise()
storage.put(key, value)
has
key: path/filename returns: Promise()<Boolean>
storage.has(key)
keys
returns: Promise()<Array>
storage.keys()
values
returns: Promise()<Array>
storage.values(limit)
build for browser
rollup
import resolve from '@rollup/plugin-node-resolve'
export default [{
input: './node_modules/@leofcoin/src/storage.js',
output: {
file: 'dist/storage.js',
format: 'es'
}
}, {
input: './node_modules/@leofcoin/src/browser-store.js',
output: {
file: 'dist/browser-store.js',
format: 'es'
},
plugins: [
resolve()
]
}]
14 days ago
21 days ago
28 days ago
28 days ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
5 months ago
7 months ago
7 months ago
7 months ago
9 months ago
6 months ago
7 months ago
9 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago