Skip to content

Instantly share code, notes, and snippets.

@aredridel
Created June 8, 2011 07:23
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aredridel/1013963 to your computer and use it in GitHub Desktop.
Save aredridel/1013963 to your computer and use it in GitHub Desktop.
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
@hamin
Copy link

hamin commented Jun 8, 2011

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

@aredridel
Copy link
Author

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