mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-16 06:31:04 +00:00
Update file.js
This commit is contained in:
parent
9b0e67a12a
commit
ae82ef5d95
11
lib/file.js
11
lib/file.js
|
@ -70,6 +70,15 @@ function readFile(FN, charset) {
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
function writeFile(FN, content, 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");
|
var pipe = PipeIPC.connect("volatile");
|
||||||
pipe.setCharset(charset);
|
pipe.setCharset(charset);
|
||||||
pipe.startRecorder(FN, PipeIPC.ForWriting);
|
pipe.startRecorder(FN, PipeIPC.ForWriting);
|
||||||
|
@ -180,6 +189,6 @@ exports.includeFile = includeFile;
|
||||||
exports.appendFile = appendFile;
|
exports.appendFile = appendFile;
|
||||||
exports.rotateFile = rotateFile;
|
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.global = global;
|
||||||
exports.require = global.require;
|
exports.require = global.require;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user