Update file.js

This commit is contained in:
Namhyeon Go 2023-09-21 20:47:43 +09:00 committed by GitHub
parent 9b0e67a12a
commit ae82ef5d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,6 +70,15 @@ function readFile(FN, charset) {
/////////////////////////////////////////////////////////////////////////////////
function writeFile(FN, content, charset) {
if (typeof content === "undefined") {
console.warn("The content parameter has not been passed. Force to empty string.");
content = '';
}
if (typeof charset === "undefined") {
console.warn("The charset parameter has not been passed. Force to UTF-8.");
charset = PipeIPC.CdoUTF_8;
}
var pipe = PipeIPC.connect("volatile");
pipe.setCharset(charset);
pipe.startRecorder(FN, PipeIPC.ForWriting);
@ -180,6 +189,6 @@ exports.includeFile = includeFile;
exports.appendFile = appendFile;
exports.rotateFile = rotateFile;
exports.VERSIONINFO = "File Library (file.js) version 0.2.6";
exports.VERSIONINFO = "File Library (file.js) version 0.2.7";
exports.global = global;
exports.require = global.require;