{"action":"created","issue":{"url":"https://api.github.com/repos/expressjs/compression/issues/56","labels_url":"https://api.github.com/repos/expressjs/compression/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/expressjs/compression/issues/56/comments","events_url":"https://api.github.com/repos/expressjs/compression/issues/56/events","html_url":"https://github.com/expressjs/compression/issues/56","id":112473423,"number":56,"title":"res.write not sending chunks until res.end() is called","user":{"login":"bijoythomas","id":5385730,"avatar_url":"https://avatars.githubusercontent.com/u/5385730?v=3","gravatar_id":"","url":"https://api.github.com/users/bijoythomas","html_url":"https://github.com/bijoythomas","followers_url":"https://api.github.com/users/bijoythomas/followers","following_url":"https://api.github.com/users/bijoythomas/following{/other_user}","gists_url":"https://api.github.com/users/bijoythomas/gists{/gist_id}","starred_url":"https://api.github.com/users/bijoythomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bijoythomas/subscriptions","organizations_url":"https://api.github.com/users/bijoythomas/orgs","repos_url":"https://api.github.com/users/bijoythomas/repos","events_url":"https://api.github.com/users/bijoythomas/events{/privacy}","received_events_url":"https://api.github.com/users/bijoythomas/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-20T22:29:18Z","updated_at":"2015-10-20T23:36:07Z","closed_at":"2015-10-20T23:36:07Z","body":"I'm using node v.0.12.0 with express (v4.4.1) and compression (v1.6.0)\r\n\r\nI'm sending back about 80MB of dynamically generated data (not from FS or DB) in multiple res.write() calls. When I add the compression middle ware (with no options passed), I don't see any traffic (using WireShark) from the Node server until the res.end() is called. When res.end() is called, there is a sudden burst of chunked data.\r\n\r\nBut when the compression module is not used, I see chunked responses going on the wire. The size of each of these chunked fragments seems to be between 10K and 16K (based on WireShark).\r\n\r\nThe only header information I am setting happens before the res.write() calls and is:\r\nres.setHeader('Content-Type', 'application/json');\r\n\r\nAny reason why the data is getting buffered before the res.end() call?"},"comment":{"url":"https://api.github.com/repos/expressjs/compression/issues/comments/149735247","html_url":"https://github.com/expressjs/compression/issues/56#issuecomment-149735247","issue_url":"https://api.github.com/repos/expressjs/compression/issues/56","id":149735247,"user":{"login":"dougwilson","id":67512,"avatar_url":"https://avatars.githubusercontent.com/u/67512?v=3","gravatar_id":"","url":"https://api.github.com/users/dougwilson","html_url":"https://github.com/dougwilson","followers_url":"https://api.github.com/users/dougwilson/followers","following_url":"https://api.github.com/users/dougwilson/following{/other_user}","gists_url":"https://api.github.com/users/dougwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/dougwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougwilson/subscriptions","organizations_url":"https://api.github.com/users/dougwilson/orgs","repos_url":"https://api.github.com/users/dougwilson/repos","events_url":"https://api.github.com/users/dougwilson/events{/privacy}","received_events_url":"https://api.github.com/users/dougwilson/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T23:36:07Z","updated_at":"2015-10-20T23:36:07Z","body":"Basically you are just describing to me exactly how gzip compression and the Node.js core zlib stream works and not actually a bug. Let me know if my answer above helps at all. If you think there is a legitimate bug, let me know the specifics and even perhaps a PR :)"}}