block-stream

a stream of blocks

Usage no npm install needed!

<script type="module">
  import blockStream from 'https://cdn.skypack.dev/block-stream';
</script>

README

block-stream

A stream of blocks.

Write data into it, and it'll output data in buffer blocks the size you specify, padding with zeroes if necessary.

var block = new BlockStream(512)
fs.createReadStream("some-file").pipe(block)
block.pipe(fs.createWriteStream("block-file"))

When .end() or .flush() is called, it'll pad the block with zeroes.