npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

multilevel-http-temp

v0.0.4

Published

Temporary multilevel http package

Downloads

10

Readme

multilevel-http

Access a leveldb instance from multiple processes via HTTP.

A limitation of LevelDB is that only one process is allowed access to the underlying data. multilevel-http exports a LevelDB instance over http.

Build Status

Installation

npm install multilevel-http

API

Server:

var multilevel = require('multilevel-http')
// db = levelup instance or path to db
var server = multilevel.server(db, meta)
server.listen(5000)

Client:

var multilevel = require('multilevel-http')
var db = multilevel.client('http://localhost:5000/')
// now you have the complete levelUP api!
// ...except for events, for now

For more advanced stuff (http auth, custom value encoding), checkout the examples folder.

CLI

$ sudo npm install -g multilevel-http
$ multilevel-http -p 5000 path/to.db

HTTP API

Params

Use get-params to pass options to LevelDB, like ?encoding=json

GET /meta

Get meta information about the DB.

// GET /meta
{
  "compression" : false,
  "cacheSize" : 8 * 1024 * 1024,
  "encoding" : 'utf8',
  "keyEncoding" : 'utf8',
  "valueEncoding" : 'utf8',
  "path" : path
}

GET /data/:key

Get tha value stored at :key.

// GET /data/foo
bar

POST /data/:key

Store data at :key.

// POST /data/foo bar
"ok"

DEL /data/:key

Delete data stored at :key.

// DEL /data/foo
"ok"

PUT /data

Store many values batched.

/* PUT /data [
  { key : 'bar', value : 'baz' },
  { key : 'foo', value : 'bar' }
] */

POST /data

Do many operations batched.

/* PUT /data [
  { type : 'put', key : 'bar', value : 'baz' },
  { type : 'del', key : 'foo' }
] */

GET /approximateSize/:from..:to

Get an approximation of disk space used to store the data in the given range.

// GET /approximateSize/a..z
123

GET /data

Get all the data.

// GET /data/12
[
  { key : 'bar', value : 'baz' },
  { key : 'foo', value : 'bar' },
  /* ... */
]

GET /range/:from..:to

Get all data in the given range.

// GET /range/a..c
[ { key : 'bar', value : 'baz' } ]

GET /keys

Get all the keys.

// GET /keys
[ 'bar', 'foo' ]

GET /keys/:from..:to

Get all the keys in the given range.

// GET /keys/a..c
[ 'bar' ]

GET /values

Get all the values.

// GET /values
[ 'baz', 'bar' ]

GET /values/:from..:to

Get all the values in the given range.

// GET /values/a..c
[ 'baz' ]

Server API

// server
var multilevel = require('multilevel-http')('my.db')
multilevel.listen(3000)

multilevel.server(path|db, meta)

server#listen(port)

Start serving on the given port.

server#{db,meta}

The stored db and meta data exposed.

License

(MIT)

Copyright (c) 2013 Julian Gruber <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.