memdown

WebJar for memdown

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

memdown
Последняя версия

Последняя версия

1.1.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

memdown
WebJar for memdown
Ссылка на сайт

Ссылка на сайт

http://webjars.org

Скачать memdown

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/memdown/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>memdown</artifactId>
    <version>1.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/memdown/
implementation 'org.webjars.npm:memdown:1.1.2'
// https://jarcasting.com/artifacts/org.webjars.npm/memdown/
implementation ("org.webjars.npm:memdown:1.1.2")
'org.webjars.npm:memdown:jar:1.1.2'
<dependency org="org.webjars.npm" name="memdown" rev="1.1.2">
  <artifact name="memdown" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='memdown', version='1.1.2')
)
libraryDependencies += "org.webjars.npm" % "memdown" % "1.1.2"
[org.webjars.npm/memdown "1.1.2"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.webjars.npm : inherits jar [2.0.1,2.1)
org.webjars.npm : ltgt jar [1.0.2,1.1)
org.webjars.npm : functional-red-black-tree jar [1.0.1,2)
org.webjars.npm : abstract-leveldown jar [2.0.3,3)

Модули Проекта

Данный проект не имеет модулей.

memdown

In-memory abstract-leveldown store for Node.js and browsers.

level badge npm Node version Travis Coverage Status JavaScript Style Guide npm Backers on Open Collective Sponsors on Open Collective

Example

If you are upgrading: please see the upgrade guide.

const levelup = require('levelup')
const memdown = require('memdown')

const db = levelup(memdown())

db.put('hey', 'you', (err) => {
  if (err) throw err

  db.get('hey', { asBuffer: false }, (err, value) => {
    if (err) throw err
    console.log(value) // 'you'
  })
})

Your data is discarded when the process ends or you release a reference to the store. Note as well, though the internals of memdown operate synchronously - levelup does not.

Browser support

Sauce Test Status

Data types

Keys and values can be strings or Buffers. Any other key type will be irreversibly stringified. The only exceptions are null and undefined. Keys and values of that type are rejected.

const db = levelup(memdown())

db.put('example', 123, (err) => {
  if (err) throw err

  db.createReadStream({
    keyAsBuffer: false,
    valueAsBuffer: false
  }).on('data', (entry) => {
    console.log(typeof entry.key) // 'string'
    console.log(typeof entry.value) // 'string'
  })
})

If you desire non-destructive encoding (e.g. to store and retrieve numbers as-is), wrap memdown with encoding-down. Alternatively install level-mem which conveniently bundles levelup, memdown and encoding-down. Such an approach is also recommended if you want to achieve universal (isomorphic) behavior. For example, you could have leveldown in a backend and memdown in the frontend.

const encode = require('encoding-down')
const db = levelup(encode(memdown(), { valueEncoding: 'json' }))

db.put('example', 123, (err) => {
  if (err) throw err

  db.createReadStream({
    keyAsBuffer: false,
    valueAsBuffer: false
  }).on('data', (entry) => {
    console.log(typeof entry.key) // 'string'
    console.log(typeof entry.value) // 'number'
  })
})

Snapshot guarantees

A memdown store is backed by a fully persistent data structure and thus has snapshot guarantees. Meaning that reads operate on a snapshot in time, unaffected by simultaneous writes.

Test

In addition to the regular npm test, you can test memdown in a browser of choice with:

npm run test-browser-local

To check code coverage:

npm run coverage

Contributing

Level/memdown 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.

Big Thanks

Cross-browser Testing Platform and Open Source Provided by Sauce Labs.

Sauce Labs logo

Donate

To sustain Level and its activities, become a backer or sponsor on Open Collective. Your logo or avatar will be displayed on our 28+ GitHub repositories and npm packages. 💖

Backers

Open Collective backers

Sponsors

Open Collective sponsors

License

MIT © 2013-present Rod Vagg and Contributors.

org.webjars.npm

Level

Create transparent databases.

Версии библиотеки

Версия
1.1.2