0.0.2 • Published 7 years ago

pull-recvfrom v0.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

pull-recvfrom

a pull-stream for recvfrom

this module provides a source stream interface to recvfrom

npm i pull-recvfrom

pullfrom(string, number, recvfrom)

parameter signature, pullfrom(str, n, fn):

  • string, a unix datagram socket path

  • number, buffer recv size

  • recvfrom, a reference to recvfrom

for example:

const pullfrom = require('pull-recvfrom')
const recvfrom = require('recvfrom')

const sockpath = `/tmp/mysocketpath`
const sz = 99999

const pull = require('pull-stream')

pull(
  pullfrom(sockpath, sz, recvfrom), // pass address and recvfrom to pullfrom()
  pull.drain(console.log)
)

the buffer limit configuration sz is an optional parameter

you can pass a reference to recvfrom, after the unix socket path:

pullfrom('/tmp/mysocketpath', require('recvfrom'))

MIT