November's Paddleball Marathon
Introducing npm Teams! Private packages + team management tools.Learn more »

printastic-protocol

0.0.0 • Public • Published

Build Status

printastic-protocol

a simple json wire protocol that supports streaming file transfers.

example

 
var duplexStream = require('printastic-protocol')();
 
var client = require('net').connect({port:1111});
 
client.pipe(duplexStream).pipe(client);
 
 
duplexStream.on('message',function(data){
  if(data.type === "file" && duplexStream.authorized()) {
    console.log('got a file');
    var ws = data.stream.pipe(require('fs').createWriteStream('./afile.txt'));
    ws.on('end',function(){
      console.log('saved file');
    });
  } else {
    console.log('got a message',data);
  }
});
 
 

Keywords

none

Install

npm i printastic-protocol

DownloadsWeekly Downloads

2

Version

0.0.0

License

none

Last publish

Collaborators

  • avatar