Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
NodeJS script to play ACSII Star Wars (using a hidden cursor)
/**
* A little script to play the ACSII Star Wars, but with a hidden
* cursor, since over telnet the cursor remains visible
*/
var net = require('net')
var cursor = require('ansi')(process.stdout)
// connect to Star Wars server
var socket = net.connect(23, 'towel.blinkenlights.nl')
socket.on('connect', function () {
cursor.hide()
socket.pipe(process.stdout)
})
process.on('SIGINT', function () {
socket.destroy()
})
process.on('exit', function () {
cursor.show().write('\n')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.