Comments (10)
It must be a bug in your application code serving the file. What are the headers? Is Content-Disposition
set?
from node-archiver.
I'm using express:
archiver.finalize(function(err, written) {
if (err) {
throw err;
}
res.header('Content-Disposition', 'attachment; filename='+req.params.file);
//res.header('Content-Type', 'application/zip'); // also tried this
res.header("Content-Type", "application/octet-stream")
//console.log(written + ' total bytes written');
res.end();
});
Issue only encountered in Chrome (Chrome 27.0.1453.93).
from node-archiver.
Could you provide the whole test so I could try it?
from node-archiver.
I can give you a link:
http://alexduloz.github.io/picnicc.bootstrap/customize.html
Posting code that you could use will take me time.
from node-archiver.
There's no Content-Disposition
nor Content-Type
.
$ curl -s -D - https://picni.cc/builds/alexduloz/picnicc.bootstrap.zip/4d0552662f651878e36000ac5a2485ce/picnicc.bootstrap.zip -o /dev/null
HTTP/1.1 200 OK
Server: cloudflare-nginx
Date: Wed, 05 Jun 2013 14:44:17 GMT
Transfer-Encoding: chunked
Connection: keep-alive
access-control-allow-origin: *
access-control-allow-headers: X-Requested-With
x-content-type-options: nosniff
x-powered-by: picni.cc
CF-RAY: 79da3d410b604a3
from node-archiver.
So the code posted above should work, correct? I checked on nodejitsu, the correct snapshot is active. Anyway, thanks for the kind help.
:)
from node-archiver.
Well, I don't have the code to tell you, but there's surely something wrong with it, since the headers sent are not correct, as shown above.
from node-archiver.
hum wouldn't you pass the headers at beginning?
from node-archiver.
How embarrassing...
All I had to do was send the correct headers before anything else. I somehow misunderstood the .finalize method.
res.header('Content-Disposition', 'attachment; filename=some-file-name.zip');
res.header('Content-Type', 'application/zip');
from node-archiver.
No worries :) Feel free to close the issue.
from node-archiver.
Related Issues (20)
- Zlib Memory Consumption
- Update dependency for `archiver-utils` (deprecation warning) HOT 2
- Node 20 tests failing with open handles
- Fails to stream to S3 using AWS SDK v3 HOT 15
- How to wait till the zipping completed HOT 2
- How to make the compression structure consistent with the win11 default compression structure
- 压缩后文件的修改时间不正确
- achiver.directory can't use, error with input source must be valid Stream or Buffer instance error HOT 1
- How to zip single file HOT 1
- Dependency Dashboard
- ESM HOT 1
- .directory() generate a empty folder, compress completed will remove the empty folder,could I retain the empty folder?
- Class extends value undefined is not a constructor or null HOT 1
- Is there a way to know how many files were ultimately compressed? HOT 2
- Question: Were there any API changes from 5.3 to 6.x? HOT 1
- Recommendation for an unzip library? HOT 1
- Overwrite existing files
- Missing Release of Resource after Effective Lifetime [High Severity] HOT 1
- zlib level 0 stops the progress of ongoing read streams
- Improve docs around append callback? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-archiver.