sindresorhus / gulp-zip Goto Github PK
View Code? Open in Web Editor NEWZIP compress files
License: MIT License
ZIP compress files
License: MIT License
Hi,
I generated a ZIP with gulp-zip on Windows and then tried to open it with native unarchiver on OSX. I got an "Error 1 - Operation not permitted". The file can be open on Windows and on Linux & OSX with the "unzip" command line. Also, the file can be open with an alternative application on OSX (The Unarchiver).
After some investigations, I discovered the extracted folder could not be deleted from OSX Finder. So I tried to delete it from command line, and could only delete some sub-files and sub-folder, but not 2 specific folders.
I tried to use ls -@l
command to display extended attribute keys of these folders, and this was the result :
The folders "img" and "css" were put in quarantine by OSX !
Do you know if it could be linked to gulp-zip ?
Thanks for your help.
Julien
I have a base project folder with this structure:
backup
dest
node_modules
src
gulpfile.js
package.json
I want to backup dest and src folders + gulpfile.js and package.json. I try several ways and nothing works:
return gulp.src(['./**/*', '!' + backup_dir, '!' + node_dir])
.pipe(zip(backup_dir + name))
.pipe(gulp.dest('.'));
return gulp.src([source_dir + '**/*', dest_dir + '**/*', '!' + backup_dir, '!' + node_dir])
.pipe(zip(backup_dir + name))
.pipe(gulp.dest('.'));
in first way it zip complete project folder and in second it merge all files and there is no dest and src folder.
what should i do?
Is there a way to create the zip such that the root directory used is preserved?
So that ./dist/foo/**/*
will unzip into ./foo
I'm using this module to create a ZIP containing a massive node-webkit .app
. If I unzip with OSX's unzip
on the command-line (no flags or errors returned) then the app will not open. The error I found in the Console utility is:
Attempting to SIGCONT to pid #37280 failed, with errno=#3 , or the process failed to actually start.
This is weird because I would assume it has nothing to do with this module (but rather the unzipping or a problem with my node-webkit app) but...
unzip
from the command-line like before), it's fine.After zipping with gulp-zip, extracting with unzip
and then running chmod -R 777 my.app
, it's fine. Could be related to nwjs/nw.js#1303 (comment).
[email protected]
OSX 10.9.1
Node v0.10.24
Great module. Thanks for doing this. For some reason, I can't get it to pull in a .htaccess file in the zipped bundle. have tried:
var Src = 'aws/*';
and
gulp.task('aws_zip', function () {
var Src = 'aws/*';
var Dst = 'aws';
return gulp.src(Src)
.pipe(zip('aws_archive.zip'))
.pipe(gulp.dest(Dst));
});
Any suggestions? Thanks.
Created a pretty basic sample. The zip file is written to disc, and the file size reported by Windows does seem to suggest that something is in there. However, navigating inside the file shows nothing. Also, extracting the file reports that the zip archive is invalid.
// Process scripts and concatenate them into one output file
gulp.task('build', ['clean'], function () {
gulp.src(['./addon.*', './changelog.txt', 'fanart.jpg', 'icon.png', 'LICENSE.txt'])
.pipe(gulp.dest(bases.dist+'/'+bases.pkg));
gulp.src(['./resources/**/*'])
.pipe(gulp.dest(bases.dist+'/'+bases.pkg+'/resources'));
gulp.src(bases.dist+'/'+bases.pkg)
.pipe(zip(bases.pkg+'.zip'))
.pipe(gulp.dest(bases.dist));
});
Task written is as below:
gulp.task('default', function () {
return gulp.src('*')
.pipe(zip('archive.zip'))
.pipe(gulp.dest('./'));
});
When I try to unpack the archive produced by gulp-zip, I sometimes get error: invalid compressed data to inflate
This happens with some PNG files as well as JS files. The file size is, however, not zero as far as I can tell.
It would be nice if the cwd wasn't included in the zip archive as the root folder, or is this a limitation of how zip works on a Mac?
I'm used to be able to add files from dir /foo/bar/**/*
to an archive, set the cwd to foo
and end up with /bar/**/*
as the archive structure.
Right now gulp-zip takes the cwd as the root, so you'll always end up with /foo/bar/**/*
inside the archive.
Any possible solution to that?
... would be nice :)
I have the following code and can't make it work:
gulp.src(dist_dir+'**/*', {base:'.'})
.pipe(zip('archive.zip'))
.pipe(gulp.dest('dist/'))
I get an error every time I run it with different configurations:
TypeError: Cannot read property 'length' of null in index.js:65
entry.uncompressedSize = buffer.length;
^
Right now you are using file cwd, making it impossible to flatten files.
That being said, is there a sensible way how to support custom archive folder where files will end up?
trying to zip an around 58MB large exe-file on windows with the latest gulp but the plugin doesnt finish the job. also with a 68mb avi file.
a 40mb exe job however gets zipped in finite time :-) any ideas or hints how I could narrow the problem down or get around it?
gulp-util has an instance of chalk built in.
Removing require('chalk')
, and replacing chalk.blue
with gutil.colors.blue
will keep it even with gulp's plugin style.
All my zips include an zero-byte archive with the same filename (build.zip
).
$ node -v
v4.2.3
/home/batman/dev/arkham_routing_app
Files:
deploy/
files/
application.jar
pics/
buddies/
robin.jpg
icon.svg
LICENSE
bin/
const deployDir = "./deploy";
return gulp.src('**/*', { base: deployDir + '/files', cwd: deployDir + '/files/' })
// Compress the shebang
.pipe(zip('build.zip'))
.pipe(gulp.dest(deployDir + '/bin'));
Result (zip content):
home/
batman/
dev/
arkham_routing_app/
deploy/
bin/
build.zip
application.jar
pics/
buddies/
robin.jpg
icon.svg
LICENSE
Expected result:
application.jar
pics/
buddies/
robin.jpg
icon.svg
LICENSE
Noticed that some files in archive are zero size, that happens only with graphics files, png, jpg.
Ubuntu
On windows, fs.stat
of directory returns 040644, and since yazl mode option is set using this value when called from gulp-zip, the unzipped directory on linux cannot be accesed.
For directories, it should use 040775 as yazl does or leave the decision to yazl itself.
I need zip the content in nested directories but i dont know a recursive parameter or similar function
I was trying to confirm that #38 is fixed but I got this:
/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp-zip/node_modules/yazl/index.js:230
if (metadataPath === "") throw new Error("empty metadataPath");
^
Error: empty metadataPath
at validateMetadataPath (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp-zip/node_modules/yazl/index.js:230:34)
at ZipFile.addBuffer (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp-zip/node_modules/yazl/index.js:61:18)
at DestroyableTransform.through.obj.zip.end.zip.outputStream.pipe.concatStream.push.gutil.File.cwd [as _transform] (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp-zip/index.js:33:7)
at DestroyableTransform.Transform._read (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp-zip/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
at DestroyableTransform.Transform._write (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp-zip/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
at doWrite (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp-zip/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
at writeOrBuffer (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp-zip/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:227:5)
at DestroyableTransform.Writable.write (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp-zip/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)
at write (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
at flow (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
at DestroyableTransform.pipeOnReadable (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:664:5)
at DestroyableTransform.EventEmitter.emit (events.js:92:17)
at emitReadable_ (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:448:10)
at emitReadable (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:444:5)
at readableAddChunk (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:187:9)
at DestroyableTransform.Readable.push (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:149:10)
at DestroyableTransform.Transform.push (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:145:32)
at afterTransform (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:101:12)
at TransformState.afterTransform (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:79:12)
at DestroyableTransform.noop [as _transform] (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/through2.js:26:3)
at DestroyableTransform.Transform._read (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
at DestroyableTransform.Transform._write (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
at doWrite (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
at writeOrBuffer (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:227:5)
at DestroyableTransform.Writable.write (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)
at write (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
at flow (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
at DestroyableTransform.pipeOnReadable (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:664:5)
at DestroyableTransform.EventEmitter.emit (events.js:92:17)
at emitReadable_ (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:448:10)
at emitReadable (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:444:5)
at readableAddChunk (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:187:9)
at DestroyableTransform.Readable.push (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:149:10)
at DestroyableTransform.Transform.push (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:145:32)
at afterTransform (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:101:12)
at TransformState.afterTransform (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:79:12)
at readDir (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/readDir.js:5:3)
at DestroyableTransform._transform (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/index.js:13:14)
at DestroyableTransform.Transform._read (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
at DestroyableTransform.Transform._write (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
at doWrite (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
at writeOrBuffer (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:227:5)
at DestroyableTransform.Writable.write (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)
at write (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
at flow (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
at DestroyableTransform.pipeOnReadable (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:664:5)
at DestroyableTransform.EventEmitter.emit (events.js:92:17)
at emitReadable_ (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:448:10)
at emitReadable (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:444:5)
at readableAddChunk (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:187:9)
at DestroyableTransform.Readable.push (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:149:10)
at DestroyableTransform.Transform.push (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:145:32)
at afterTransform (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:101:12)
at TransformState.afterTransform (/Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:79:12)
at /Users/adam/Code/GitHub/teamwork-chat-client/node_modules/gulp/node_modules/vinyl-fs/lib/src/getStats.js:15:5
at Object.oncomplete (evalmachine.<anonymous>:107:15)
cc @kevva
Hello,
I have following folder structure:
gulp.task('ziptest', function () {
return gulp.src('zip_test/**')
.pipe(ziptest('archive.zip'))
.pipe(gulp.dest(''));
});
As a result I have archive.zip with all folders except /folder2
Test environment:
It seems the module is ignoring folders that hare prefixed with .
I have a folder with the following structure:
dist/
-- .cordova/
-- hooks/
-- www/
I want a zip that will unzip to the following:
.cordova/
hooks/
www/
Here is my task setup:
gulp.task('zip-release', ['package-release'], function() {
return gulp.src('dist/**/')
.pipe(zip('release.zip'))
.pipe(gulp.dest('.'));
})
I end up with the hooks
and www
folders inside the zip, but not the .cordova
folder.
Clearly doing this
gulp.task('build', ['clean', 'html', 'images', 'fonts'], function() {
return gulp.src('dist/**/*').
pipe($.size({title: 'build', gzip: true})).
pipe($.zip('tremor.zip')).
pipe(gulp.dest('dist'));
});
produces a zip with a flat file structure, but i want the zip file to unzip into a folder when running unzip command, so is there any way to stuff all the output into a folder before zipping it up?
Hi! I'm having a problem when I'm using gulp-clean.
It's pretty hard to reproduce, but, basically, everytime I use gulp-clean or rimraf, the generated zip misses some files.
This works:
gulp.task('clean', function() {
rimraf.sync(opts.build);
});
gulp.task('zip', ['build'], function() {
return gulp.src([
opts.build + '**/*.*'
], {
base: opts.build
})
.pipe(using())
.pipe(zip('build.zip'))
.pipe(gulp.dest(opts.build));
});
gulp.task('build', ['config', 'webconfig', 'vendor', 'less', 'js', 'html', 'index']);
This doesn't:
gulp.task('clean', function() {
rimraf.sync(opts.build);
});
gulp.task('zip', ['build'], function() {
return gulp.src([
opts.build + '**/*.*'
], {
base: opts.build
})
.pipe(using())
.pipe(zip('build.zip'))
.pipe(gulp.dest(opts.build));
});
gulp.task('build', ['clean', 'config', 'webconfig', 'vendor', 'less', 'js', 'html', 'index']);
Notice the clean in the second 'build' task. Whenever I run the second example, the zip task misses two files (app.js and index.html).
The first example runs just fine, but I can't guarantee that all files are the new files.
Any thoughts?
Yazl sould be updated to fix this issue:
gulp.task('default', function () {
gulp.src('src/*')
.pipe(zip('archive.zip'))
.pipe(gulp.dest('dist'));
});
The above results in the "src" folder being the top level within the zip file. How do I make the contents of "src" the top level of the zip instead?
Is it possible to use the filename from gulp.src as filename for the generated archive?
I have a list of folders like this
packages
- package-1
- package-2
- package-3
and want to generate:
build
- package-1.zip
- package-2.zip
- package-3.zip
First problem:
if i provide gulp.src('packages/*') it generates one zip file which contains all 3 folders.
How can i split this into 3 separate zipfiles?
second problem:
zip('archive.zip') takes the filename as string. is there a way to provide the filename from gulp.src?
This fix (i think) broke my AWS lambda function. With 3.0.2 it works fine but with 3.1.0, the AWS lambda isn't able to load external modules.
(it could be something else but we have explicitly tested with the only change being the version number of gulp-zip)
I'm not saying this is a bug in gulp-zip - but i would like to know if there are options to set it back to the permissions i think were working. if you think it was some other change between 3.0.2 and 3.1.0, i'd be glad to explore that too.
Thanks for your help.
I use gulp-zip to archive the folder
build.js
build.css
But I extract the zip, it contain a folder, how can I ignore that folder
archive
| - build.js
` - build.css
I need to turn off compression for a project. Would be great if I could pass compression: 'STORE'
(which would be passed along to jszip). We could still default to 'DEFLATE'
.
Trying to zip a file 1GB or larger fails with the following error:
RangeError: File size is greater than possible Buffer: 0x3FFFFFFF bytes
This is easily reproducible by creating a 1GB file ("truncate -s 1024M output.file" is probably the quickest way to test this Linux/OSX/Cygwin) and running gulp-zip on that directory. Multiple files just under 1GB work just fine, so it's definitely the size of each input file, not the combined size.
I do this:
var entryPointPath = 'build/debug/myproject/myservice/*';
var outputFile = 'package.zip';
var outputPath = 'dist/debug/myproject';
return gulp.src(entryPointPath)
.pipe(gzip(outputFile))
.pipe(gulp.dest(outputPath));
After all runs, I see the package.zip
is inside dist/debug/myproject/package.zip
which is good and expected.
But the package is also present in build/debug/myproject/package.zip
, why does this happen ?
How can it be avoided ?
It would be nice to support encryption with a password.
when running the following:
gulp.task('zip', function () {
gulp.src('build/**/*')
.pipe(zip('build.' + pkg.version + '.zip'))
.pipe(gulp.dest('builds'));
});
the archive is created correctly (with the inner path problem mentioned in other issues).
The problem is that other dirs are created in my target builds
directory.
These dirs do exist in the src
build folder, but obvoiusly I don't want them to be re-created empty in the target builds
directory.
Any help on this?
Please add option to set default mode for folders in zip archive under windows.
Finally trying gulp out tonight and I'm not sure if I'm just not getting it, too tired, or there's a bug in this module.
Though the two tests pass, I can repeat this with the included gulpfile
:
~/projects/pr/gulp-zip ✓ master ❯ cat gulpfile.js
var gulp = require('gulp');
var zip = require('./index');
gulp.task('default', function () {
gulp.src('fixture/fixture.txt')
.pipe(zip('test.zip'))
.pipe(gulp.dest('dest'));
});
~/projects/pr/gulp-zip ✓ master ❯ gulp
[00:09:58] Using gulpfile ~/projects/pr/gulp-zip/gulpfile.js
[00:09:58] Starting 'default'...
[00:09:58] Finished 'default' after 7.7 ms
~/projects/pr/gulp-zip ✓ master ❯ ls -al dest
ls: dest: No such file or directory
There's a new feature in jszip
to add comments in zip files, would be awesome to have these kind of options here too.
I have error with your example code:
node_modules/gulp-zip/node_modules/yazl/index.js:65
entry.uncompressedSize = buffer.length;
^
TypeError: Cannot read property 'length' of null
Hi!
I would like to propose to change the way params gets passed.
The problem is that when creating dynamically the filename value (using async tasks or functions) the filename is not updated.
For example (maybe to raw):
module.exports = function () {
var filename = 'file_';
return gulp.src(path)
.pipe(through.obj(function (file, enc, cb) {
exec("git rev-parse --abbrev-ref HEAD", {cwd: file.cwd}, function (err, stdout, stderr) {
filename = filename + stdout;
this.push(file);
cb();
}.bind(this));
}))
.pipe(zip(filename + '.zip'))
}
The output zip will always have the following name: file_.zip
Perhaps there is an easy way to solve this, but haven't found it.
I would propose to add the possibility to pass functions as params, as here: gulpjs/vinyl-fs@583d30e
After updating to latest version (3.1.0) archives created on windows machines (Confirmed on win8 and win10) are corrupted.
Works fine on OSX.
Version 3.0.2 was ok.
Edit: This is weird since they are not really corrupted. They appear as corrupted on both OSX and linux machines, but are fine on windows machines.
Archiving on windows prevents opening files on linux/OSX.
Archiving on OSX/Linux is fine.
This prevents deployment to services such as EBS, which require zip to be uploaded.
Hello, I zip font files from FonfAwesome, then when trying to unzip it using default Mac archive utility app, nothing happens. When using unarchiver.app I got error on decrunching
To replicate, I just use:
gulp.src('**', {cwd: path.join(process.cwd(), 'project/fonts')})
.pipe(zip('fonts.zip'))
.pipe(gulp.dest('dist/fonts')),
project/fonts
contain all the default 4 fonts downloaded from http://fontawesome.io/
Do you have any idea what happens?
I use it to zip a folder, there is a folder named filename.docset
in this folder, it not works (do nothing).
For example, it's like https://github.com/exlee/d3-dash-gen D3JS.docset
.
What's wrong?
See also JSZip doc: https://stuk.github.io/jszip/documentation/api_jszip/file_data.html
As document mentioned, we should just update zip entry if the zip file does exist rather than recreate a new zip again, so that it could combine with gulp-changed to speed up our incremental build.
Try to open exist zip by var zip = new JSZip(filePath)
at [1].
[1] https://github.com/sindresorhus/gulp-zip/blob/master/index.js#L17
Sorry I can't be more descriptive, but if you create a zip of a chrome extension folder with gulp-zip and try and upload it to the chrome webstore the server will reject the file with an error. http://i.imgur.com/dTqk6Kz.png. I also noticed that zipping the same folder from the OS X command line results in a file size that is about 1k larger than when zipping with gulp http://i.imgur.com/rvlCXsq.png. This is the only info I have from google {"errorMessage":{"reason":"REQUEST_REJECTED","additionalInfo":{"uploader_service.GoogleRupioAdditionalInfo":{"completionInfo":{"status":"REJECTED","customerSpecificInfo":{"extension_id":"null","errors":["Chrome Web Store system error, please try again later."],"upload_status":"FAILURE"}},"requestRejectedInfo":{"reasonDescription":"agent_rejected"}}},"upload_id":"redacted"}}
2.0.3 works 100%.
Upgrade to 3.0.0 and get this:
[23:06:54] Using gulpfile ~/dev/git/lunchbug/site/gulpfile.js
[23:06:54] Starting 'zip'...
/home/xxx/lunchbug/site/node_modules/gulp-zip/node_modules/yazl/index.js:65
entry.uncompressedSize = buffer.length;
^
TypeError: Cannot read property 'length' of null
at ZipFile.addBuffer (/home/xxx/site/node_modules/gulp-zip/node_modules/yazl/index.js:65:34)
at DestroyableTransform.through.obj.zip.end.zip.outputStream.pipe.concatStream.push.gutil.File.cwd [as _transform] (/home/xxx/site/node_modules/gulp-zip/index.js:33:7)
We're having some problems right now with zip files generated by gulp-zip because the D
attribute is not added to directories included in the zip file. The zip files we're using are being processed by an android library that apparently looks for that attribute to find directories before crawling them, and because it's missing the whole process is just ending right there. I'm not exactly sure how the file list is fed to gulp-zip from the gulp.src
call, but I did see that the jsZip library has a .folder
method as well as the .file
method that gulp-zip currently uses. Would it be possible to check each member of the input list using fs.stat
and switch between .folder
and .file
depending on whether or not that item is a file or directory?
I have folders structure:
| build
|_irep
|_name1
|_file1
|_file2
|_name2
|_file3
|_file4
I need to zip each folder in directory build/irep including directory in name1, name2 in zips
So as a result I should have two zip files like this:
name1.zip
|_name1
|_file1
|_file2
I've found a solution using rename plugin and changing directory but I guess there is better solution (probably using cwd), but I could not find it.
My task:
gulp.src('build/irep/' + fullName + '/**')
.pipe(rename(function (path) {
path.dirname = fullName + '/' + path.dirname;
}))
.pipe(zip(fullName + '.zip'))
.pipe(gulp.dest('build/irep'));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.