Last active
August 29, 2015 14:21
-
-
Save jcrugzz/cd2eb5aa5a69080fe6f6 to your computer and use it in GitHub Desktop.
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
/Users/jcruger/github/jcrugzz/sublevel-repro/node_modules/level-party-hyper/node_modules/multileveldown/node_modules/pbs/node_modules/protocol-buffers/encodings.js:19 | |
return Buffer.isBuffer(val) ? val.length : Buffer.byteLength(val) | |
^ | |
TypeError: Argument must be a string | |
at exports.bytes.bufferLength (/Users/jcruger/github/jcrugzz/sublevel-repro/node_modules/level-party-hyper/node_modules/multileveldown/node_modules/pbs/node_modules/protocol-buffers/encodings.js:19:55) | |
at Object.exports.bytes.encodingLength (/Users/jcruger/github/jcrugzz/sublevel-repro/node_modules/level-party-hyper/node_modules/multileveldown/node_modules/pbs/node_modules/protocol-buffers/encodings.js:23:15) | |
at Object.encodingLength (eval at <anonymous> (/Users/jcruger/github/jcrugzz/sublevel-repro/node_modules/level-party-hyper/node_modules/multileveldown/node_modules/pbs/node_modules/generate-function/index.js:55:21), <anonymous>:8:20) | |
at Object.encodingLength (eval at <anonymous> (/Users/jcruger/github/jcrugzz/sublevel-repro/node_modules/level-party-hyper/node_modules/multileveldown/node_modules/pbs/node_modules/generate-function/index.js:55:21), <anonymous>:10:24) | |
at Encoder.(anonymous function) [as batches] (/Users/jcruger/github/jcrugzz/sublevel-repro/node_modules/level-party-hyper/node_modules/multileveldown/node_modules/pbs/encoder.js:57:19) | |
at Multilevel._batch (/Users/jcruger/github/jcrugzz/sublevel-repro/node_modules/level-party-hyper/node_modules/multileveldown/leveldown.js:215:34) | |
at AbstractLevelDOWN.batch (/Users/jcruger/github/jcrugzz/sublevel-repro/node_modules/level-party-hyper/node_modules/multileveldown/node_modules/abstract-leveldown/abstract-leveldown.js:162:17) | |
at SubDown.batch.SubDown._batch (/Users/jcruger/github/jcrugzz/sublevel-repro/node_modules/subleveldown/leveldown.js:107:18) | |
at LevelUP.batch (/Users/jcruger/github/jcrugzz/sublevel-repro/node_modules/subleveldown/node_modules/levelup/lib/levelup.js:340:11) | |
at LevelBatchStream.batch (/Users/jcruger/github/jcrugzz/sublevel-repro/node_modules/level-batch-stream/index.js:53:11) |
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
var level = require('level-party-hyper'); | |
var through = require('through2'); | |
var LevelBatch = require('level-batch-stream'); | |
var sublevel = require('subleveldown'); | |
var streamify = require('stream-array'); | |
var monotonic = require('monotonic-timestamp'); | |
var uuid = require('uuid'); | |
var db = level('test.db'); | |
var sub = sublevel(db, 'whatever', { valueEncoding: 'utf8' }); | |
var ids = [uuid.v4(), uuid.v4(), uuid.v4()]; | |
// | |
// This silently dies | |
// | |
streamify(ids.map(function (id) { | |
// | |
// If we left monotonic without the toSstring(), we get an encoding error that is present | |
// in this gist as well | |
// | |
return { type: 'put', key: monotonic().toString(), value: id }; | |
})) | |
.pipe(through.obj(function (data, enc, cb) { | |
console.dir(data); | |
cb(null, data); | |
})) | |
.pipe(new LevelBatch(sub)) | |
.on('error', console.error.bind(console)) | |
.on('retry', console.dir.bind(console)) | |
.on('finish', console.log.bind(console, 'finished')); |
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
{ | |
"name": "sublevel-repro", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"dependencies": { | |
"level-batch-stream": "^1.3.1", | |
"level-party-hyper": "^2.1.1", | |
"monotonic-timestamp": "^0.0.9", | |
"stream-array": "^1.1.0", | |
"subleveldown": "^2.0.0", | |
"through2": "^0.6.5", | |
"uuid": "^2.0.1" | |
}, | |
"devDependencies": {}, | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment