![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
memory-level
Advanced tools
Changelog
[1.0.0] - 2022-01-30
:seedling: Initial release. If you are upgrading from memdown
: please see UPGRADING.md
.
Readme
In-memory abstract-level
database for Node.js and browsers, backed by a fully persistent red-black tree. The successor to memdown
and level-mem
.
:pushpin: Which module should I use? What is
abstract-level
? Head over to the FAQ.
If you are upgrading: please see UPGRADING.md
.
const { MemoryLevel } = require('memory-level')
// Create a database
const db = new MemoryLevel({ valueEncoding: 'json' })
// Add an entry with key 'a' and value 1
await db.put('a', 1)
// Add multiple entries
await db.batch([{ type: 'put', key: 'b', value: 2 }])
// Get value of key 'a': 1
const value = await db.get('a')
// Iterate entries with keys that are greater than 'a'
for await (const [key, value] of db.iterator({ gt: 'a' })) {
console.log(value) // 2
}
With callbacks:
db.put('example', { hello: 'world' }, (err) => {
if (err) throw err
db.get('example', (err, value) => {
if (err) throw err
console.log(value) // { hello: 'world' }
})
})
The API of memory-level
follows that of abstract-level
with a one additional constructor option (see below). The createIfMissing
and errorIfExists
options of abstract-level
are not relevant here. Data is discarded when the last reference to the database is released (i.e. db = null
). Closing or reopening the database has no effect on the data. Data is not copied: when storing a Buffer value for example, subsequent mutations to that Buffer will affect the stored data too.
db = new MemoryLevel([options])
Besides abstract-level
options, the optional options
object may contain:
storeEncoding
(string): one of 'buffer'
, 'view'
, 'utf8'
. How to store data internally. This affects which data types can be stored non-destructively. The default is 'buffer'
(that means Buffer) which is non-destructive. In browsers it may be preferable to use 'view'
(Uint8Array) to be able to exclude the buffer
shim. Or if there's no need to store binary data, then 'utf8'
(String). Regardless of the storeEncoding
, memory-level
supports input that is of any of the aforementioned types, but internally converts it to one type in order to provide a consistent sort order.With npm do:
npm install memory-level
Level/memory-level
is an OPEN Open Source Project. This means that:
Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
See the Contribution Guide for more details.
FAQs
In-memory abstract-level database for Node.js and browsers
The npm package memory-level receives a total of 44,127 weekly downloads. As such, memory-level popularity was classified as popular.
We found that memory-level 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.