Skip to content
 
 

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

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages