mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Update file.js
This commit is contained in:
parent
3d4f9c3512
commit
c5d90ad65d
22
lib/file.js
22
lib/file.js
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user