Socket
Book a DemoInstallSign in
Socket

repipe

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

repipe

reconnect/remake streams that are piped to a single output stream

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

node-repipe

reconnect/remake streams that are piped to a single output stream

Any time you would like to make a best effort to retrieve a whole stream over a connection that may be interupted this is invaluable.

This is how i use it so i can restart my db server any time.


var repipe = require('repipe');
// make database connection and ensure it reconnects automatically
var multilevel ...

var s = through();
repipe(s,function(err,last,done){
  if(err && err.message != "unexpected disconnection") return done(err);
  // its the first stream or the stream was cut off before it emitted the end event
  // start the new read stream from where it left off..
  var key;
  if(last) key = last.key+"\x00";
  done(false,multilevel.createReadStream({start:key});
});

s.on('data',function(data){
  console.log(data);
});

s.on('end',function(){
  //yay!
})


FAQs

Package last updated on 19 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts