npm

Need private packages and team management tools?Check out npm Orgs. »

pew-transport

1.0.1 • Public • Published

node-pew-transport

Using the pew-transport you can send and receive binary files via an TCP socket connection.

pew-transport have 2 simples methods to prepare your files or messages and recovery it.

See below some examples of use:

===Prepare buffer

 
var transport = require('pew-transport');
 
var buffer = new Buffer('My first test');
var buf = transport.prepare(buffer);
 
//buf is ready to send using TCP connections;
 

===Received buffer

 
var transport = require('pew-transport');
var net = require('net');
 
var server = net.createServer(function(socket) {
  socket.on('error', function(){
    console.log('server connected');
  });
  socket.on('end', function() {
    console.log('server disconnected');
  });
  socket.on('error', function(err){
    console.log('error: '+err);
  });
 
  transport.recovery(socket, transport.DEFAULT_ENDIAN, function(buff){
    //your buffer is recovered!
    console.log(buff);
  });
 
});
 
server.listen(8080);
 

install

npm i pew-transport

Downloadsweekly downloads

2

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability