Tired of getting a firehose worth of data from your streams. This module is here to save the day. PullStream allows
you to pull data when you want and as much as you want.
Quick Examples
var PullStream = require('pullstream');var fs = require('fs');var ps = new PullStream();var loremIpsumStream = fs.createReadStream('loremIpsum.txt');var outputStream = fs.createWriteStream(path.join(__dirname, 'loremIpsum.out'));loremIpsumStream.pipe(ps);// pull 5 bytesps.pull(5, function(err, data) { console.log(data.toString('utf8')); //synchronously pull 1000 bytes or howevery many bytes are available
ps.pipe(100, outputStream).on('end', function () {
console.log('all done');
});
});
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.