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
//[email protected] | |
//A very simple stress test for levelUP | |
//make lots of LorumIpsum json files, put them into batches, and then | |
//cram as many of them as possible into LevelUP | |
//At the time of writing (15 aug 2013) this will create a memory leak | |
//adjust size of batches here | |
var totalBatchFiles = 300; | |
var totalDocsPerBatchFile = 100; |
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 levelup = require('levelup') | |
var fs = require('fs'); | |
var db = levelup('./imagedb') | |
db.put('name', fs.readFileSync('image.png'), { encoding: 'binary' }, function (err) { | |
db.get('name', { encoding: 'binary' }, function (err, value) { | |
fs.writeFile('image-copy.png', value, function (err) { | |
console.log('image-copy.png saved!'); | |
}); | |
}) |
NewerOlder