From f9f2807e63635432ab175824859caa70e3c583aa Mon Sep 17 00:00:00 2001 From: Kevin Martensson Date: Fri, 2 Oct 2015 15:28:48 +0200 Subject: [PATCH] Don't unzip response in browsers This reduces the browserifed size from 471 KB to 268 KB. --- index.js | 2 +- package.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index cc39c3e..6bcf4b8 100644 --- a/index.js +++ b/index.js @@ -47,7 +47,7 @@ function requestAsEventEmitter(opts) { return; } - ee.emit('response', unzipResponse(res)); + ee.emit('response', typeof unzipResponse === 'function' ? unzipResponse(res) : res); }).once('error', function (err) { ee.emit('error', new got.RequestError(err, opts)); }); diff --git a/package.json b/package.json index 2f34a6d..c58002f 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,9 @@ "engines": { "node": ">=0.10.0" }, + "browser": { + "unzip-response": false + }, "scripts": { "test": "xo && ava" },