mirror of
https://github.com/Ylianst/MeshAgent
synced 2026-01-06 18:43:46 +00:00
Updated zip-writer so you can pass folder names
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -180,9 +180,43 @@ function next(options)
|
||||
require('fs').read(this._currentFD, { buffer: this._ubuffer }, this._uncompressedReadSink);
|
||||
}
|
||||
|
||||
function checkFiles(files)
|
||||
{
|
||||
var checked = [];
|
||||
var tmp;
|
||||
var s, j;
|
||||
|
||||
for(var i in files)
|
||||
{
|
||||
s = require('fs').statSync(files[i]);
|
||||
if(s.isFile())
|
||||
{
|
||||
checked.push(files[i]);
|
||||
}
|
||||
else if (s.isDirectory())
|
||||
{
|
||||
tmp = require('fs').readdirSync(files[i]);
|
||||
for (j in tmp)
|
||||
{
|
||||
tmp[j] = files[i] + (process.platform == 'win32' ? '\\' : '/') + tmp[j];
|
||||
}
|
||||
tmp = checkFiles(tmp);
|
||||
for(j in tmp)
|
||||
{
|
||||
checked.push(tmp[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (checked);
|
||||
}
|
||||
|
||||
function write(options)
|
||||
{
|
||||
if (!options.files || options.files.length == 0) { throw ('No file specified'); }
|
||||
|
||||
// Check if any folders were specified
|
||||
options.files = checkFiles(options.files);
|
||||
|
||||
var ret = new duplex(
|
||||
{
|
||||
write: function (chunk, flush)
|
||||
|
||||
Reference in New Issue
Block a user