Skip to content

Instantly share code, notes, and snippets.

@znxkznxk1030
Created July 15, 2021 02:15
Show Gist options
  • Save znxkznxk1030/5ce545e714cbfc6aaa08952d50468aba to your computer and use it in GitHub Desktop.
Save znxkznxk1030/5ce545e714cbfc6aaa08952d50468aba to your computer and use it in GitHub Desktop.
let fs = require('fs');
try {
let code = fs.readFileSync('in.txt', 'utf8');
// console.log(code);
let codelines = code.split("\n").map(codeline => {
return "\"" + codeline.replace("\r","") + "\""
}).join(",\n");
console.log(codelines)
fs.writeFileSync('out.txt', codelines)
} catch (e) {
console.error('Error: ', e.stack);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment