Last active
August 29, 2015 14:11
-
-
Save sethvincent/2d28a1f57319300b61f4 to your computer and use it in GitHub Desktop.
level-dat browserifies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('set-immediate') | |
var http = require('http') | |
var es = require('event-stream') | |
var ldat = require('level-dat') | |
var level = require('levelup') | |
var leveljs = require('level-js') | |
var xhr = require('xhr') | |
var db = level('./db', { db: leveljs, valueEncoding: 'json' }) | |
dat = ldat(db) | |
xhr('http://127.0.0.1:6461/api/changes?data=true', function (err, res, body) { | |
read = es.readArray(JSON.parse(body).rows) | |
read.pipe(dat.createChangesWriteStream()) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment