3.0.0 • Published 5 years ago

level-range-emitter v3.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 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

5 years ago

2.0.16

7 years ago

2.0.15

7 years ago

2.0.14

7 years ago

2.0.13

7 years ago

2.0.12

7 years ago

2.0.11

7 years ago

2.0.10

7 years ago

2.0.9

7 years ago

2.0.8

7 years ago

2.0.7

7 years ago

2.0.6

7 years ago

2.0.5

7 years ago

2.0.4

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago