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

rethinkdown

v0.3.0

Published

A RethinkDB implementation of the LevelDOWN API

Downloads

4

Readme

rethinkdown

A RethinkDB implementation of the LevelDOWN API

Tested with RethinkDB drivers
  • rethinkdb
  • rethinkdbdash

Example (ES6)

import r from 'rethinkdb'
import rethinkdown from 'rethinkdown'

const database = 'test'
const options = { host: 'db.myserver.com' }
const table = 'mydbtable'

let db = rethinkdown(r, database, options)(table)

db.open({ createIfMissing: true }, (error) => {
  db.put('1', 'one', (error) => {
    db.get('one', { asBuffer: false }, (error, value) => {
      console.log(value)
      // > one
      db.close((error) => {
        // ...
      })
    })
  })
})

API

Refer to the LevelDOWN or AbstractLevelDOWN documentation for full API


RethinkDOWN ( driver, [database], [connectOptions] )

A RethinDOWN instance needs to first be initialized with either a rethinkdb or rethinkdbdash driver, optional database name, and optional connection options

Parameters

  • driver {rethinkdb|rethinkdbdash} - Supported RethinkDB driver
  • [database="test"] {String} - Database name to use
  • [connectOptions] {Object} - A rethinkdb or rethinkdbdash connect options object
  • [connectOptions.singleTable] {String} - Single mode table name

Returns {rethinkdown} - Instance of rethinkdown that can be passed a location/table

Example
import r from 'rethinkdbdash'
import RethinkDOWN from 'rethinkdown'

let rethinkdown = RethinkDOWN(r, 'test', { silent: true })
let db = rethinkdown('myleveldb')

rethinkdown ( location )

returns a new RethinkDOWN instance

Parameters

  • location {String} - table name or record filter when using single mode

Returns {RethinkDOWN}


location

The location should be the name of the table that should be used as the LevelDB store. All non-alphanumeric and _ characters will be replaced with _

Single-Mode since v0.3.0

Single mode allows the same table to be used for all level databases. The table name specified by connectOptions.singleTable will store all data and the location will be added as a value in each record so that multiple databases can be stored in the same table.

Single Mode Example
import r from 'rethinkdb'
import RethinkDOWN from 'rethinkdown'

let rethinkdown = RethinkDOWN(r, 'test', { singleTable: 'myleveldb' })
let db1 = rethinkdown('db1')
let db2 = rethinkdown('db2')