substack / Sparse Chunk Store
Licence: other
populate and query a chunk store with sparse blocks
Programming Languages
javascript
184084 projects - #8 most used programming language
sparse-chunk-store
populate and query a chunk store with sparse blocks
example
put
var sparse = require('sparse-chunk-store')
var fdstore = require('fd-chunk-store')
var sp = sparse(32, fdstore(32, '/tmp/chunks'))
var n = Number(process.argv[2])
var buf = Buffer(process.argv[3])
sp.put(n, buf, function (err) {
if (err) console.error(err)
})
get
var sparse = require('sparse-chunk-store')
var fdstore = require('fd-chunk-store')
var sp = sparse(32, fdstore(32, '/tmp/chunks'))
var n = Number(process.argv[2])
sp.get(n, function (err, buf) {
if (err) console.error(err)
else console.log(buf.toString())
})
api
var sparse = require('sparse-chunk-store')
var sp = sparse(size, store, opts)
var sp = sparse(store, opts)
Return a sparse chunk store sp
from a non-sparse chunk store store
.
If store.size
is defined, size
can be omitted as an explicit parameter.
Set opts.cache
to true
to buffer index tables in memory for a speed boost.
sp.get(index, opts={}, cb)
Read the block data at index
as cb(err, buf)
.
sp.put(index, opts={}, cb)
Write block data at index
.
install
npm install sparse-chunk-store
license
MIT
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].