Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
nedb-promise
Advanced tools
Readme
A promise wrapper for NeDB.
Install with NPM:
$ npm i --save nedb-promise
Example using ES7 async/await:
import datastore from 'nedb-promise'
async function doDatabaseStuff() {
let DB = datastore({
// these options are passed through to nedb.Datastore
filename: 'my-db.json',
autoload: true // so that we don't have to call loadDatabase()
})
await DB.insert([{
num: 1, alpha: 'a'
}, {
num: 2, alpha: 'b'
}])
let document = await DB.findOne({ num: 1 })
// use NeDB cursors:
let documents = await DB.cfind({})
.projection({ num: 1, _id: 0 })
.exec()
}
doDatabaseStuff()
Returns an object that proxies to an internal nedb.Datastore
instance (options
are passed through to the NeDB constructor), with promisified methods.
It also includes extension methods cfind(...)
, cfindOne(...)
, and ccount(...)
that return promisified cursors, so that you may do:
let results = await myDataStore.cfind({ moo: 'goo' })
.projection({ moo: 1, _id: 0 }) // see NeDB cursor methods
.exec()
Use this method if you already have a NeDB instance that you want to wrap with the promisified methods.
Run tests with mocha (after building):
$ mocha test.js
Copyright (c) 2015, Jonathan Apodaca jrapodaca@gmail.com Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
FAQs
A promise wrapper around the nedb package
The npm package nedb-promise receives a total of 148 weekly downloads. As such, nedb-promise popularity was classified as not popular.
We found that nedb-promise 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.