Answer the question
In order to leave comments, you need to log in
Write to file from console?
fs.writeFile('./public/library.js',obfuscationResult.getObfuscatedCode(),function(err){
fs.readFile('./public/library.js',"utf8",function(error,data){
fs.writeFile('./public/library.js','/*\n* JavaScript Library v1.1.77\n');
fs.appendFile('./public/library.js',data);
});
});
Answer the question
In order to leave comments, you need to log in
The fact is that I already tried several options but they did not work. In particular, the read module.
The recording was made before I entered the data in the console.
Here is an option with readline that works
fs.writeFile('./public/library.js',obfuscationResult.getObfuscatedCode(),function(err){
fs.readFile('./public/library.js',"utf8",function(error,data){
var rl = readline.createInterface({
input:process.stdin,
output:process.stdout
});
rl.question('What do you think of Node.js? ', (answer) => {
fs.writeFile('./public/library.js','/*\n* JavaScript Library v'+answer);
fs.appendFile('./public/library.js',data);
rl.close();
});
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question