Last active
June 8, 2017 12:46
-
-
Save ralphtheninja/879a79a4c92d170f9c21e098ed20ebe9 to your computer and use it in GitHub Desktop.
some leveldown test files
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
// segfaults | |
var levelup = require('levelup') | |
var db = levelup('./test1.db') | |
db.put('foo', 'bar', { sync: true }, function (err) { | |
console.log('back from put', err) | |
}) | |
db.close(function (err) { | |
console.log('closed the db', err) | |
}) |
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
// segfaults | |
var db = require('leveldown')('./test2.db') | |
var iterator = db.iterator() |
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
// this should be extracted to a test file for leveldown, the stream _should_ error | |
const level = require('levelup') | |
const db = level('./test3.db') | |
const N = 10000 | |
const batch = [] | |
for (var i = 0; i < N; i++) { | |
batch.push({ type: 'put', key: i, value: 'a' }) | |
} | |
db.batch(batch, function (err) { | |
if (err) throw err | |
db.createReadStream() | |
.once('data', function (data) { | |
db.close() | |
}) | |
.on('error', function (err) { | |
console.log('readstream error') | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment