squishjs 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Asset.js +7 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squishjs",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "squish & unsquish stuff",
5
5
  "scripts": {
6
6
  "test": "node testRunner.js"
package/src/Asset.js CHANGED
@@ -166,16 +166,15 @@ class Asset {
166
166
  resolve(filePath);
167
167
  });
168
168
 
169
- let data = '';
170
169
  getModule.get(`${ASSET_URL}/${assetId}`, (res) => {
171
- res.on('data', (chunk) => {
172
- data += chunk;
173
- writeStream.write(chunk);
174
- });
175
- res.on('end', () => {
176
- writeStream.end();
170
+ writeStream.on('finish', () => {
171
+ writeStream.close();
177
172
  });
173
+
174
+ res.pipe(writeStream);
178
175
  }).on('error', error => {
176
+ console.error('Failed to download asset');
177
+ console.error(error);
179
178
  reject(error);
180
179
  });
181
180
  });
@@ -184,3 +183,4 @@ class Asset {
184
183
  }
185
184
 
186
185
  module.exports = Asset;
186
+