mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 06:54:58 +00:00
Update file.js
This commit is contained in:
parent
7a1086108c
commit
e28f346447
12
lib/file.js
12
lib/file.js
|
@ -65,9 +65,9 @@ function readFile(FN, charset) {
|
|||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function writeFile(FN, content, charset) {
|
||||
var pipe = PipeIPC.connect(PipeIPC.createUUIDv4().substring(0, 8));
|
||||
var pipe = PipeIPC.connect("volatile");
|
||||
pipe.setCharset(charset);
|
||||
pipe.startRecorder(FN, PipeIPC.ForWriting);
|
||||
pipe.startRecorder(FN, PipeIPC.ForWriting);
|
||||
pipe.write(content);
|
||||
pipe.destroy();
|
||||
return true;
|
||||
|
@ -139,20 +139,22 @@ function includeFile(FN) {
|
|||
}
|
||||
|
||||
function appendFile(FN, content, charset) {
|
||||
var pipe = PipeIPC.connect("write");
|
||||
var pipe = PipeIPC.connect("volatile");
|
||||
pipe.setCharset(charset);
|
||||
pipe.startRecorder(FN, PipeIPC.ForAppending);
|
||||
pipe.write(content);
|
||||
pipe.destroy();
|
||||
return true;
|
||||
}
|
||||
|
||||
function rotateFile(FN, content, numOfLines, charset) {
|
||||
var pipe = PipeIPC.connect("write");
|
||||
var pipe = PipeIPC.connect("volatile");
|
||||
pipe.setCharset(charset);
|
||||
pipe.setMaxSentences(numOfLines);
|
||||
pipe.startRecorder(FN, PipeIPC.ForAppending);
|
||||
pipe.write(content);
|
||||
pipe.destroy();
|
||||
return true;
|
||||
}
|
||||
|
||||
exports.fileExists = fileExists;
|
||||
|
@ -169,6 +171,6 @@ exports.includeFile = includeFile;
|
|||
exports.appendFile = appendFile;
|
||||
exports.rotateFile = rotateFile;
|
||||
|
||||
exports.VERSIONINFO = "File Library (file.js) version 0.2.3";
|
||||
exports.VERSIONINFO = "File Library (file.js) version 0.2.4";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
Loading…
Reference in New Issue
Block a user