Update pipe-ipc.js

This commit is contained in:
Namhyeon Go 2023-09-20 14:59:30 +09:00 committed by GitHub
parent 30f16cf3e8
commit 3999bcc171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,16 +69,18 @@ function createADO() {
return CreateObject("ADODB.Stream");
}
function SetPositionADO(ado, position) {
var newAdo = createADO();
newAdo.Type = adTypeBinary;
newAdo.Mode = adModeReadWrite;
newAdo.Open();
ado.Position = position;
ado.CopyTo(newAdo);
ado.Flush();
ado.Close();
return newAdo;
function AdoConvertToStream(ado, position) {
position = (position !== "undefined" ? position : 0);
var newAdo = createADO();
newAdo.Type = adTypeBinary;
newAdo.Mode = adModeReadWrite;
newAdo.Open();
ado.Position = position;
ado.CopyTo(newAdo);
ado.Flush();
ado.Close();
return newAdo;
}
function PipeIPC() {
@ -167,7 +169,7 @@ function PipeIPC() {
}
// with iomode (default: ForAppending)
var iomode = (iomode !== "undefined" ? ForAppending : iomode);
iomode = (iomode !== "undefined" ? ForAppending : iomode);
this.openRecorder(iomode);
};
@ -197,7 +199,7 @@ function PipeIPC() {
this.write = function(message, iomode) {
// with iomode (default: ForAppending)
var iomode = (iomode !== "undefined" ? ForAppending : iomode);
iomode = (iomode !== "undefined" ? ForAppending : iomode);
if (this.savefile != null) {
this.record(message);
@ -273,7 +275,7 @@ function PipeIPC() {
ado.Charset = charset;
ado.Open();
ado.WriteText(str);
ado = SetPositionADO(ado, 3);
ado = AdoConvertToStream(ado, 3);
ado.SaveToFile(dst, adSaveCreateOverWrite);
ado.Close();
@ -405,7 +407,7 @@ exports.adSaveCreateNotExist = adSaveCreateNotExist;
exports.adSaveCreateOverWrite = adSaveCreateOverWrite;
exports.adModeReadWrite = adModeReadWrite;
exports.VERSIONINFO = "PIPE-based IPC Module (pipe-ipc.js) version 0.1.9";
exports.VERSIONINFO = "PIPE-based IPC Module (pipe-ipc.js) version 0.1.10";
exports.AUTHOR = "abuse@catswords.net";
exports.global = global;
exports.require = require;