{"action":"created","issue":{"url":"https://api.github.com/repos/archiverjs/node-archiver/issues/170","labels_url":"https://api.github.com/repos/archiverjs/node-archiver/issues/170/labels{/name}","comments_url":"https://api.github.com/repos/archiverjs/node-archiver/issues/170/comments","events_url":"https://api.github.com/repos/archiverjs/node-archiver/issues/170/events","html_url":"https://github.com/archiverjs/node-archiver/issues/170","id":119273690,"number":170,"title":"Streaming to res not working, getting empty errored file","user":{"login":"romain10009","id":7512202,"avatar_url":"https://avatars.githubusercontent.com/u/7512202?v=3","gravatar_id":"","url":"https://api.github.com/users/romain10009","html_url":"https://github.com/romain10009","followers_url":"https://api.github.com/users/romain10009/followers","following_url":"https://api.github.com/users/romain10009/following{/other_user}","gists_url":"https://api.github.com/users/romain10009/gists{/gist_id}","starred_url":"https://api.github.com/users/romain10009/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romain10009/subscriptions","organizations_url":"https://api.github.com/users/romain10009/orgs","repos_url":"https://api.github.com/users/romain10009/repos","events_url":"https://api.github.com/users/romain10009/events{/privacy}","received_events_url":"https://api.github.com/users/romain10009/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-28T06:12:35Z","updated_at":"2015-11-29T00:36:55Z","closed_at":null,"body":"Hello, I run in quite the same issue (when streaming to file it works, when streaming to http client it gives corrupt files.), #161 seems to have same issues, but i'm runing on local with nodejs and nodemon, on windows. version of node is 4.2.1, archiver 0.17.0 here is my code. the res 'end' event is not raised. Nor is the res 'data' event.\r\n\r\n        var archive = archiver('zip');\r\n        archive.on('error', function(err) {\r\n            console.error(err);\r\n            res.status(500).send({error: err.message});\r\n        });\r\n\r\n        //on stream closed we can end the request\r\n        res.on('close', function() {\r\n            console.log('Archive wrote %d bytes', archive.pointer());\r\n            return res.status(200).send('OK').end();\r\n        });\r\n\r\n        res.attachment('myzip.zip');\r\n\r\n        //this is the streaming magic\r\n        archive.pipe(res);\r\n\r\n        archive.append('hello zip1',{name : 'text1.txt'});\r\n        archive.append('hellooooo zip2',{ name : 'test2.txt'});\r\n\r\n                archive.finalize(function(err, bytes) {\r\n                    if (err) {\r\n                        throw err;\r\n                    }\r\n                    console.log(bytes + ' total bytes');\r\n                });\r\n        );\r\n\r\nhere is what i get as a file : \r\n![image](https://cloud.githubusercontent.com/assets/7512202/11440750/324216b8-9540-11e5-918e-d73c9cfe0ae2.png)\r\n\r\nthe example i'm inspired by is this one : \r\nhttp://stackoverflow.com/questions/20107303/dynamically-create-and-stream-zip-to-client/25210806#25210806"},"comment":{"url":"https://api.github.com/repos/archiverjs/node-archiver/issues/comments/160350126","html_url":"https://github.com/archiverjs/node-archiver/issues/170#issuecomment-160350126","issue_url":"https://api.github.com/repos/archiverjs/node-archiver/issues/170","id":160350126,"user":{"login":"soyuka","id":1321971,"avatar_url":"https://avatars.githubusercontent.com/u/1321971?v=3","gravatar_id":"","url":"https://api.github.com/users/soyuka","html_url":"https://github.com/soyuka","followers_url":"https://api.github.com/users/soyuka/followers","following_url":"https://api.github.com/users/soyuka/following{/other_user}","gists_url":"https://api.github.com/users/soyuka/gists{/gist_id}","starred_url":"https://api.github.com/users/soyuka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soyuka/subscriptions","organizations_url":"https://api.github.com/users/soyuka/orgs","repos_url":"https://api.github.com/users/soyuka/repos","events_url":"https://api.github.com/users/soyuka/events{/privacy}","received_events_url":"https://api.github.com/users/soyuka/received_events","type":"User","site_admin":false},"created_at":"2015-11-29T00:36:55Z","updated_at":"2015-11-29T00:36:55Z","body":"By using `on('end')` event. See [this example](\nhttps://github.com/archiverjs/node-archiver/blob/master/examples/express.js)\nwith expressjs.\nLe dim. 29 nov. 2015 à 00:35, Sky Lightna <notifications@github.com> a\nécrit :\n\n> @ctalkington <https://github.com/ctalkington> I apologize in advance\n> since I only picked up node earlier this week, but how will I know that\n> finalize has finished executing without the use of a callback?\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/archiverjs/node-archiver/issues/170#issuecomment-160345754>\n> .\n>\n"}}