Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
level-js is a JavaScript implementation of LevelDB for use in the browser. It provides a simple key-value store API that is compatible with the LevelUP interface, making it easy to use in conjunction with other LevelDB-based libraries.
Basic Key-Value Store
This feature allows you to perform basic key-value operations such as putting, getting, and deleting data in the database.
const level = require('level-js');
const db = level('my-database');
// Put a value
await db.put('key', 'value');
// Get a value
const value = await db.get('key');
console.log(value); // 'value'
// Delete a value
await db.del('key');
Batch Operations
Batch operations allow you to perform multiple put and delete operations in a single atomic action, which can be more efficient than performing each operation individually.
const level = require('level-js');
const db = level('my-database');
// Perform batch operations
await db.batch()
.put('key1', 'value1')
.put('key2', 'value2')
.del('key3')
.write();
Stream API
The Stream API allows you to create readable and writable streams for iterating over the database entries, which is useful for processing large datasets.
const level = require('level-js');
const db = level('my-database');
// Create a read stream
const stream = db.createReadStream();
stream.on('data', ({ key, value }) => {
console.log(key, value);
});
stream.on('end', () => {
console.log('Stream ended');
});
PouchDB is an open-source JavaScript database inspired by Apache CouchDB that is designed to run well within the browser. It provides a similar key-value store functionality but also includes advanced features like synchronization with CouchDB and other PouchDB instances.
LocalForage is a fast and simple storage library for JavaScript. It improves the offline experience of your web app by using asynchronous storage (IndexedDB or WebSQL) with a simple, localStorage-like API. It is more abstracted compared to level-js and is designed to be easier to use.
Dexie.js is a wrapper for IndexedDB that provides a more developer-friendly API. It offers advanced querying capabilities and transaction support, making it a powerful alternative to level-js for complex use cases.
level.js an implementation of the leveldown API on top of IndexedDB (which is in turn implemented on top of LevelDB, which brings this whole shebang full circle)
Most people use levelup on top of this library. See test-levelup.js
for details
For some demos of it working, see @brycebaril's presentation "Path of the NodeBases Jedi": http://brycebaril.github.io/nodebase_jedi/#/vanilla
level.js uses IDBWrapper by jensarps to ensure compatibility between IDB implementations.
Here are the goals of this level.js:
Being leveldown compatible means you can use many of the level-* modules on top of this library.
npm install level-js
(Not to be confused with leveljs)
This library is best used with browserify
var leveljs = require('level-js')
var db = leveljs('bigdata')
db.open(function onOpen() { })
The test suite for this library is in the abstract-leveldown repo and is shared between various leveldown implementations across different environments and platforms.
For more code examples see the abstract-leveldown test suite
The only differences between this and leveldown is that you can store ArrayBuffers
in this (whereas leveldown just uses node Buffer
objects)
git clone git@github.com:maxogden/level.js.git
cd level.js
npm install
npm test
open localhost:9966
Then look in your browser console
BSD
FAQs
An abstract-leveldown compliant store on top of IndexedDB
The npm package level-js receives a total of 410,267 weekly downloads. As such, level-js popularity was classified as popular.
We found that level-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.