Socket
Book a DemoInstallSign in
Socket

printastic-protocol

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

printastic-protocol

a simple json wire protocol that supports binary file transfers. For talking with printastic servers.

latest
npmnpm
Version
0.0.0
Version published
Maintainers
1
Created
Source

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

print

FAQs

Package last updated on 10 Feb 2013

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