forked from kalmar/DALGLI0
19 lines
408 B
JavaScript
19 lines
408 B
JavaScript
const crc = require("./crc.js");
|
|
let message = process.argv[3];
|
|
let flag = process.argv[2];
|
|
switch (flag) {
|
|
case '-e':
|
|
console.log(crc.encode(message).encoded);
|
|
break;
|
|
case '-d':
|
|
let fcs = JSON.parse(process.argv[4].replace(/'/g, '"'));
|
|
|
|
console.log(crc.decode(message, fcs));
|
|
break;
|
|
case '-t':
|
|
|
|
|
|
break;
|
|
default:
|
|
throw "incorect flag"
|
|
} |