📅  最后修改于: 2022-03-11 15:02:49.687000             🧑  作者: Mango
'use strict';
import fs from 'fs';
let fileContent = 'Anything what you want';
let message = fs.writeFileSync('message.txt', fileContent);
function copyContent(fileName: string, dest: string): boolean {
try {
fs.copyFileSync(fileName, dest);
console.log(dest);
return true;
} catch (err) {
return false;
}
}
console.log(copyContent('message.txt', 'destination.txt'));