@dstanesc/o-o-o-o-o-o-o
Version:
O-O-O-O-O-O-O is a collection of content addressed persistent data structures
16 lines • 515 B
JavaScript
const chunkerFactory = (targetSize, compute_chunks_provider) => {
const sizeRange = (avg) => {
return {
minSize: Math.floor(avg / 2),
avgSize: avg,
maxSize: avg * 2,
};
};
const chunk = (buffer) => {
const { minSize, avgSize, maxSize } = sizeRange(targetSize);
return compute_chunks_provider(buffer, minSize, avgSize, maxSize).subarray(1);
};
return { chunk };
};
export { chunkerFactory };
//# sourceMappingURL=chunking.js.map