Created
November 18, 2010 05:45
-
-
Save ry/704668 to your computer and use it in GitHub Desktop.
This file contains 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 | |
// requires node v0.3 | |
// telnet.js 80 google.com | |
net = require('net'); | |
a = process.argv.slice(2); | |
if (!a.length) { | |
console.error("telnet.js port [ host=localhost ]"); | |
process.exit(1); | |
} | |
s = require('net').Stream(); | |
s.connect.apply(s, a); | |
s.pipe(process.stdout); | |
process.openStdin().pipe(s); |
I second that. I really like how streams have evolved with pipe(). Very cool.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That is kinda too awesome. Only what about \commands? :P