3.0.0 • Published 6 years ago

level-range-emitter v3.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

level-range-emitter

range emitter hooks for leveldb

client and server using multileveldown, range-emitter and ltgt

js-standard-style Greenkeeper badge downloads

client example

const websocket = require('websocket-stream')
const multileveldown = require('multileveldown')
const rangeEmitter = require('level-range-emitter').client
const db = multileveldown.client({ keyEncoding: 'utf8', valueEnoding: 'json', retry: true })
const re = rangeEmitter(db)
;(function connect () {
  const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws'
  const url = `${protocol}://${window.location.host}/db`
  const ws = websocket(url)
  const remote = db.connect()
  re.session(remote, ws)
  ws.on('close', window.setTimeout.bind(window, connect, 3000))
})()

re.subscribe((key, type) => console.log('changed %s', key, type))

server example

  const lre = require('level-range-emitter').server(db)
  const session = lre.session
  const dbStream = multileveldown.server(dbInstance)
  session(dbStream, stream)
3.0.0

6 years ago

2.0.16

8 years ago

2.0.15

8 years ago

2.0.14

8 years ago

2.0.13

8 years ago

2.0.12

8 years ago

2.0.11

8 years ago

2.0.10

8 years ago

2.0.9

8 years ago

2.0.8

8 years ago

2.0.7

8 years ago

2.0.6

8 years ago

2.0.5

9 years ago

2.0.4

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago