git ssb

0+

cel / pull-block-filter



Branch:
cel committed Add repository URLLatest: 033a94f on 1/7/2020, 12:41:25 AM
📄README.md
📄index.js
📄package.json
📄test.js
README.md

pull-block-filter

Filter parts of a stream of buffers in blocks.

Example

var blockFilter = require('pull-block-filter')
var pull = require('pull-stream')

pull(
  pull.once(new Buffer([1, 2, 3, 4, 5, 6, 7, 8])),
  blockFilter(pull.values([{skip: 1, length: 2}, {skip: 3, length: 1}])),
  pull.collect(function (err, bufs) {
    var buf = Buffer.concat(bufs)
    // buf: Buffer([2, 3, 7])
  })
)

API

blockFilter(readBlock) : through stream

Create a through stream that filters data based on readBlocks. readBlocks is a source stream of objects representing how to read the source stream that is pulled through blockFilter(). Each skip means to skip some number of bytes/elements from the source stream, and length means to then pass through some bytes/elements.

License

Copyright (c) 2016 Charles Lehner

Usage of the works is permitted provided that this instrument is retained with the works, so that any entity that uses the works is notified of this instrument.

DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.

Built with git-ssb-web