Created
September 19, 2018 00:28
-
-
Save bencooper222/1fb26912dbbe9313db7ea45a41eed4f3 to your computer and use it in GitHub Desktop.
Reader for swipe data from Vanderbilt cards scanned by: https://smile.amazon.com/Deftun-3-Track-Magnetic-Magstripe-Scanner/dp/B01DVWQ2BO/ref=sr_1_5?ie=UTF8&qid=1537316803&sr=8-5&keywords=card+swipe&dpID=41NjGex-0pL&preST=_SY300_QL70_&dpSrc=srch
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
const swipes = []; | |
require('readline') | |
.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
terminal: false, | |
}) | |
.on('line', line => { | |
console.log('\007'); // beep beep | |
swipes.push(line.slice(1, line.search('='))); | |
}); | |
process.on('SIGINT', () => { | |
swipes.forEach(swipe => console.log(`\n${swipe}`)); | |
process.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment