Skip to content

Instantly share code, notes, and snippets.

Created Jun 8, 2011
What would you like to do?
Read from a stream: works with a FIFO.
var fs = require('fs')
var s = fs.createReadStream('x')
s.on('data', function(b) { console.log(b) })
mkfifo x
node reader.js &
echo "Hello!" > x
Copy link

hamin commented Jun 8, 2011

nice :) . Were you think of using something like this for anything in particular?

Copy link

aredridel commented Jun 8, 2011

Nope. Just a question on #node.js -- "how do I read from a FIFO in node?" -- answered in code. I personally find fifos entirely antiquated and it's usually better to use a socket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment