Update file.js

This commit is contained in:
Namhyeon Go 2022-09-22 14:41:01 +09:00 committed by GitHub
parent 3d4f9c3512
commit c5d90ad65d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,9 +13,15 @@ var LIB = require("lib/std");
// Private APIs / Utility functions // Private APIs / Utility functions
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
exports.VERSIONINFO = "File Lib (file.js) version 0.2"; // StreamTypeEnum
exports.global = global; // https://learn.microsoft.com/en-us/sql/ado/reference/ado-api/streamtypeenum?view=sql-server-ver16
exports.require = global.require; var adTypeBinary = 1;
var adTypeText = 2;
// SaveOptionsEnum
// https://learn.microsoft.com/en-us/sql/ado/reference/ado-api/saveoptionsenum?view=sql-server-ver16
var adSaveCreateNotExist = 1;
var adSaveCreateOverWrite = 2;
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// fileExists // fileExists
@ -147,10 +153,8 @@ function writeFile(FN, content, charset) {
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
function writeBinaryFile(FN, DATA) { function writeBinaryFile(FN, DATA) {
var adTypeText = 1;
var adSaveCreateOverWrite = 2;
var BinaryStream = CreateObject("ADODB.Stream"); var BinaryStream = CreateObject("ADODB.Stream");
BinaryStream.Type = adTypeText; BinaryStream.Type = adTypeBinary;
BinaryStream.Open(); BinaryStream.Open();
BinaryStream.Write(DATA); BinaryStream.Write(DATA);
BinaryStream.SaveToFile(FN, adSaveCreateOverWrite); BinaryStream.SaveToFile(FN, adSaveCreateOverWrite);
@ -232,4 +236,8 @@ exports.createFolder = createFolder;
exports.deleteFolder = deleteFolder; exports.deleteFolder = deleteFolder;
exports.deleteFile = deleteFile; exports.deleteFile = deleteFile;
exports.includeFile = includeFile; exports.includeFile = includeFile;
exports.appendFile = appendFile; exports.appendFile = appendFile;
exports.VERSIONINFO = "File Lib (file.js) version 0.2.1";
exports.global = global;
exports.require = global.require;