An abstract-random-access backend that writes to fixed size page files instead of a single file. Useful for sparse data.
npm install random-access-page-files
var pages = require('random-access-page-files')
var storage = pages('a-folder', {
pageSize: 5 * 1024 * 1024 // use 5mb pages
})
// will write use single page file < 5mb
storage.write(222852525, new Buffer('hello'), function (err) {
if (err) throw err
storage.read(222852525, 5, function (err, buf) {
if (err) throw err
console.log(buf)
})
})
Create a new storage provider. Options include:
{
pageSize: 5 * 1024 * 1024, // how big are the page files?
limit: 16 // how many open files at max?
}
MIT