Skip to content

Instantly share code, notes, and snippets.

@nateabele
Created August 23, 2017 01:53
Show Gist options
  • Save nateabele/0c0db599d5181a5ac1d40f629547def3 to your computer and use it in GitHub Desktop.
Save nateabele/0c0db599d5181a5ac1d40f629547def3 to your computer and use it in GitHub Desktop.
Just reads a list from standard in to an array.
#!/usr/bin/env node
// --Usage--
// Bash: find `pwd` -type f | ./file_map.js
// Fish: find (pwd) -type f | ./file_map.js
const readline = require('readline');
const files = [];
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
rl.on('line', files.push.bind(files));
rl.on('close', () => console.log(`Collected ${files.length} files`));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment