dataset-archive
Version:
Simple key-value storage of large sets of data in a very compact flat file, prioritising compact archival over read/write speeds. Very minimal.
25 lines (20 loc) • 411 B
JavaScript
/**
* DatasetArchive IO objects which just store everything in ram, for test rig
*/
class MemoryIO {
constructor () {
this.chunks = [];
}
async * read () {
yield * this.chunks;
}
async write (chunksIter) {
const newChunks = [];
for await (const chunk of chunksIter) {
newChunks.push(chunk);
}
this.chunks = newChunks;
}
}
module.exports = MemoryIO;
;