Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
function packProject() {
Files = ("C:\\cnc\USER\projdata");
ZipFile.create("C:\\cnc\USER\test.zip", Files, {
overwrite: true
});
}
function packProject() {
var files = ["C:\\cnc\\USER\\projdata"];
ZipFile.create("C:\\cnc\\USER\\test.zip", files, {
overwrite: true
});
}
/*
* @example
var zip = new ZipFile();
zip.addFiles("C:\\cnc\USER\projdata");
zip.save("C:\\cnc\USER\test.zip", {
overwrite: true,
});
*/
function ZipFile()
{
var self = this;
var files = [];
self.addFiles = function()
{
for (var i = 0; i < arguments.length; i++) {
files.push(arguments[i]);
}
};
self.save = function(filename, options)
{
options = options || {};
// Create the empty zip-file (it is created as an ASCII file)
var fso = new ActiveXObject("Scripting.FileSystemObject");
var zipFile = fso.CreateTextFile(filename, !! options.overwrite, 0);
zipFile.Write('PK' + String.fromCharCode(5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); // 18 zeros
zipFile.Close();
// Opens the empty archive file and a Shell folder
var shell = new ActiveXObject("Shell.Application");
var zipFolder = shell.NameSpace(fso.GetFile(filename).Path);
if ( zipFolder == null ) {
if ( typeof options.onerror == 'function' ) {
options.onerror(filename);
}
if ( fso.FileExists(filename) ) {
fso.DeleteFile(filename, true);
}
throw new TypeError();
}
// Copy files to an archive file
var o = Number(options.option) || 0;
for (var i = 0; i < files.length; i++) {
zipFolder.CopyHere(fso.GetFile(files[i]).Path, o);
}
// Sleep to be sure that the zip file was created completely
var t = ( ! options.timeout || Number(options.timeout) < 500 )
? 500
: options.timeout;
WScript.Sleep(t);
};
};
ZipFile.create = function(filename, fileList, options)
{
var zip = new ZipFile();
zip.addFiles.apply(this, fileList);
zip.save(filename, options);
};
function packProject() {
var files = ["C:\\cnc\\USER\\projdata"];
ZipFile.create("C:\\cnc\\USER\\test.zip", files, {
overwrite: true
});
}
Ich verstehe die Frage nicht. Was heißt es, einen "Pfad über 'zip.addFiles' haben" zu wollen?Kann es sein dass er den Pfad über "zip.addFiles ()" haben will?
console.log(filename);
console.log(files[i]);