Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

ipld-store

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipld-store

Minimal on-disc store for IPLD.

npmnpm
Version
0.1.1
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

ipld-store

Minimal on-disc store for IPLD.

IPLDStore(path[, safe = true])

let store = require('ipld-store')(__dirname + '/test.db')

safe means that buffers will be validated against the multihash in the cid before storage. You can turn this off for performance purposes if you're performing the hash elsewhere.

store.put(cid, buffer)

Accepts a CID instance or base58 encoded string.

Returns a promise that resolves when the data is stored.

store.get(cid)

Accepts a CID instance or base58 encoded string.

Returns a promise that resolves a Buffer instance.

Note: The buffer is not validated against the multihash in the CID on get. If you are concerned that the underlying disc store has been compromised you should perform this check manually.

store.has(cid)

Accepts a CID instance or base58 encoded string.

Returns a promise that resolves to a boolean.

store.del(cid)

Accepts a CID instance or base58 encoded string.

Returns a promise that resolves when the data is deleted.

store.bulk([transactions])

When no transactions are sent this method returns a bulk object.

transactions must be an array of transactions in the form of:

{ type: 'put',
  cid: 'zb2rhd7kzCsbM7VpTvwxcWRnwZE468yj2supGt8gwY75FsFrH',
  buffer: Buffer.from('test')}

Or

{ type: 'del',
  cid: 'zb2rhd7kzCsbM7VpTvwxcWRnwZE468yj2supGt8gwY75FsFrH'
}

Accepts a CID instance or base58 encoded string.

bulk.put(cid, buffer)

Accepts a CID instance or base58 encoded string.

Put operation is queue to be performed on flush().

bulk.del(cid)

Accepts a CID instance or base58 encoded string.

Delete operation is queue to be performed on flush().

bulk.flush()

Returns a promise that resolves when all the pending transactions are flushed to disc.

FAQs

Package last updated on 28 Jun 2018

Did you know?

Socket

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.

Install

Related posts