GithubHelp home page GithubHelp logo

Chrome issue about node-archiver HOT 10 CLOSED

archiverjs avatar archiverjs commented on June 26, 2024
Chrome issue

from node-archiver.

Comments (10)

danmilon avatar danmilon commented on June 26, 2024

It must be a bug in your application code serving the file. What are the headers? Is Content-Disposition set?

from node-archiver.

 avatar commented on June 26, 2024

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.

danmilon avatar danmilon commented on June 26, 2024

Could you provide the whole test so I could try it?

from node-archiver.

 avatar commented on June 26, 2024

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.

danmilon avatar danmilon commented on June 26, 2024

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.

 avatar commented on June 26, 2024

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.

danmilon avatar danmilon commented on June 26, 2024

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.

ctalkington avatar ctalkington commented on June 26, 2024

hum wouldn't you pass the headers at beginning?

from node-archiver.

 avatar commented on June 26, 2024

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.

danmilon avatar danmilon commented on June 26, 2024

No worries :) Feel free to close the issue.

from node-archiver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.