squishjs 1.2.0 → 1.3.0

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 +8 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squishjs",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "squish & unsquish stuff",
5
5
  "scripts": {
6
6
  "test": "node testRunner.js"
package/src/Asset.js CHANGED
@@ -177,11 +177,15 @@ class Asset {
177
177
  });
178
178
 
179
179
  getModule.get(`${ASSET_URL}/${assetId}`, (res) => {
180
- writeStream.on('finish', () => {
181
- writeStream.close();
182
- });
180
+ if (res.statusCode !== 200) {
181
+ reject('Bad response when downloading asset');
182
+ } else {
183
+ writeStream.on('finish', () => {
184
+ writeStream.close();
185
+ });
183
186
 
184
- res.pipe(writeStream);
187
+ res.pipe(writeStream);
188
+ }
185
189
  }).on('error', error => {
186
190
  console.error('Failed to download asset');
187
191
  console.error(error);