
Research
/Security News
Bitwarden CLI Compromised in Ongoing Checkmarx Supply Chain Campaign
Bitwarden CLI 2026.4.0 was compromised in the Checkmarx supply chain campaign after attackers abused a GitHub Action in Bitwarden’s CI/CD pipeline.
interface-datastore
Advanced tools
Implementation of the datastore interface in JavaScript
src/memorydatastore-level (supports any levelup compatible backend)datstore-fsdatastore-core/src/mountdatstore-core/src/keytransformdatastore-core/src/shardingdatstore-core/src/tiereddatastore-core/src/namespaceIf you want the same functionality as go-ds-flatfs, use sharding with fs.
const FsStore = require('datastore-fs')
const ShardingStore = require('datastore-core').ShardingDatatstore
const NextToLast = require('datastore-core').shard.NextToLast
const fs = new FsStore('path/to/store')
// flatfs now works like go-flatfs
const flatfs = await ShardingStore.createOrOpen(fs, new NextToLast(2))
$ npm install interface-datastore
The type definitions for this package are available on http://definitelytyped.org/. To install just use:
$ npm install -D @types/interface-datastore
const MemoryStore = require('interface-datastore').MemoryDatastore
const MountStore = require('datastore-core').MountDatastore
const Key = require('interface-datastore').Key
const store = new MountStore({ prefix: new Key('/a'), datastore: new MemoryStore() })
Available under src/tests.js
describe('mystore', () => {
require('interface-datastore/src/tests')({
async setup () {
return instanceOfMyStore
},
async teardown () {
// cleanup resources
}
})
})
To allow a better abstraction on how to address values, there is a Key class which is used as identifier. It's easy to create a key from a Buffer or a string.
const a = new Key('a')
const b = new Key(new Buffer('hello'))
The key scheme is inspired by file systems and Google App Engine key model. Keys are meant to be unique across a system. They are typically hierarchical, incorporating more and more specific namespaces. Thus keys can be deemed 'children' or 'ancestors' of other keys:
new Key('/Comedy')new Key('/Comedy/MontyPython')Also, every namespace can be parameterized to embed relevant object information. For example, the Key name (most specific namespace) could include the object type:
new Key('/Comedy/MontyPython/Actor:JohnCleese')new Key('/Comedy/MontyPython/Sketch:CheeseShop')new Key('/Comedy/MontyPython/Sketch:CheeseShop/Character:Mousebender')The exact types can be found in
src/index.js.
These methods will be present on every datastore. Key always means an instance of the above mentioned Key type. Every datastore is generic over the Value type, though currently all backing implementations are implemented only for Buffer.
has(key) -> Promise<Boolean>key: KeyCheck for the existence of a given key
const exists = await store.has(new Key('awesome'))
console.log('is it there', exists)
put(key, value) -> Promisekey: Keyvalue: ValueStore a value with the given key.
await store.put(new Key('awesome'), new Buffer('datastores'))
console.log('put content')
get(key) -> Promise<Value>key: KeyRetrieve the value stored under the given key.
const value = await store.get(new Key('awesome'))
console.log('got content: %s', value.toString())
// => got content: datastore
delete(key) -> Promisekey: KeyDelete the content stored under the given key.
await store.delete(new Key('awesome'))
console.log('deleted awesome content :(')
query(query) -> Iterablequery: Query see below for possible valuesSearch the store for some values. Returns an Iterable with each item being a Value.
// retrieve __all__ values from the store
let list = []
for await (const value of store.query({})) {
list.push(value)
}
console.log('ALL THE VALUES', list)
QueryObject in the form with the following optional properties
prefix: string (optional) - only return values where the key starts with this prefixfilters: Array<Filter<Value>> (optional) - filter the results according to the these functionsorders: Array<Order<Value>> (optional) - order the results according to these functionslimit: Number (optional) - only return this many recordsoffset: Number (optional) - skip this many records at the beginningkeysOnly: Boolean (optional) - Only return keys, no values.batch()This will return an object with which you can chain multiple operations together, with them only being executed on calling commit.
const b = store.batch()
for (let i = 0; i < 100; i++) {
b.put(new Key(`hello${i}`), new Buffer(`hello world ${i}`))
}
await b.commit()
console.log('put 100 values')
put(key, value)key: Keyvalue: ValueQueue a put operation to the store.
delete(key)key: KeyQueue a delete operation to the store.
commit() -> PromiseWrite all queued operations to the underyling store. The batch object should not be used after calling this.
open() -> PromiseOpens the datastore, this is only needed if the store was closed before, otherwise this is taken care of by the constructor.
close() -> PromiseClose the datastore, this should always be called to ensure resources are cleaned up.
PRs accepted.
Small note: If editing the Readme, please conform to the standard-readme specification.
MIT 2017 © IPFS
FAQs
datastore interface
The npm package interface-datastore receives a total of 175,487 weekly downloads. As such, interface-datastore popularity was classified as popular.
We found that interface-datastore demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.

Research
/Security News
Bitwarden CLI 2026.4.0 was compromised in the Checkmarx supply chain campaign after attackers abused a GitHub Action in Bitwarden’s CI/CD pipeline.

Research
/Security News
Docker and Socket have uncovered malicious Checkmarx KICS images and suspicious code extension releases in a broader supply chain compromise.

Product
Stay on top of alert changes with filtered subscriptions, batched summaries, and notification routing built for triage.