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.
21 lines (18 loc) • 378 B
JavaScript
/**
* DatasetArchive IO objects which just store everything in ram, for test rig
*/
export default 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
}
}