trackParser is a tiny credit card or magstripe card parser that reads in the raw string from the card and converts it to usable data. This can be used to charge a credit card as well as just read what is inside random magnetic stripe cards. For more information how magnetic cards work as well as the 3 different types of tracks available for the cards, visit This Wikipedia Article On The Magnetic Stripe Card
This library DOES support track 1, track 2, AND track 3 though track 3 is rarely used
Currently it is only available through npm or right here on github
$ npm install trackparser
consttrackParser=require('trackparser').trackParserconsttrackParserSync=require('trackparser').trackParserSync// method for parsing a credit cardvarcardinfo=trackParserSync("STRING HERE")console.log(cardinfo)// method for parsing a credit card with a callbacktrackParser("STRING HERE",function(cardinfo){console.log(cardinfo)})varcardinfo=trackParserSync("STRING HERE")if(cardinfo.successful){// the parsing was successfulconsole.log(cardinfo.account,cardinfo.lastName,cardinfo.firstName,cardinfo.expYear,cardinfo.expMonth,cardinfo.cvv)}else{console.log("There was an error parsing the track data")}// method for parsing a credit card with a callbacktrackParser("STRING HERE",function(cardinfo){if(cardinfo.successful){// the parsing was successfulconsole.log(cardinfo.account,cardinfo.lastName,cardinfo.firstName,cardinfo.expYear,cardinfo.expMonth,cardinfo.cvv)}else{console.log("There was an error parsing the track data")}})