Skip to content

Chunked stream client for the browser and Node.js

License

Notifications You must be signed in to change notification settings

and9527/pipelining

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pipelining

Xhr chunked stream client for the browser and node.js

Install

$ npm install pipelining

Usage

Client (browser or node.js)

const pipelining = require('pipelining');

const reader = pipelining('/test');

function handle(data) {
  console.log(data);
}

function read() {
  reader.read().then(partial => {
    if (partial.done) {
      return;
    }

    handle(partial.data).then(read);
  });
}

read()

Server

const pipelining = require('pipelining');
// http handler
function (req, res) {
  res.write(pipelining.pack(1));
  // after several seconds..
  res.write(pipelining.pack({ tom: 'test' }));
  // after 1 min..
  res.end();
}

About

Chunked stream client for the browser and Node.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 94.7%
  • HTML 5.3%