Last active
March 20, 2016 17:27
-
-
Save piranna/7dc47f387ecdcf739a19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var Interface = require('readline').Interface | |
var ReadStream = require('tty').ReadStream | |
var spawn = require('child_process').spawn | |
Interface(process.stdin, process.stdout) | |
var stdin = ReadStream(process.stdin.fd) | |
process.stdin.pause() | |
var stdio = [stdin, process.stdout] | |
spawn('cat', [], {stdio: stdio}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var Readable = require('stream').Readable | |
var spawn = require('child_process').spawn | |
const input = 'Habia una vez un circo que siempre alegraba el corazon' | |
const kpm = 240 | |
var stdio = ['pipe', process.stdout, process.stderr] | |
var cp = spawn('./fixture.js', [], {stdio: stdio}) | |
var stdin = new Readable() | |
stdin._read = function(){} | |
stdin.pipe(cp.stdin) | |
var index = 0 | |
function type() | |
{ | |
var data = input[index] || null | |
stdin.push(data) | |
index++ | |
if(data !== null) setTimeout(type, 60*1000/kpm) | |
} | |
type() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment