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.
- package/package.json +1 -1
- package/src/Asset.js +8 -4
package/package.json
CHANGED
package/src/Asset.js
CHANGED
|
@@ -177,11 +177,15 @@ class Asset {
|
|
|
177
177
|
});
|
|
178
178
|
|
|
179
179
|
getModule.get(`${ASSET_URL}/${assetId}`, (res) => {
|
|
180
|
-
|
|
181
|
-
|
|
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
|
-
|
|
187
|
+
res.pipe(writeStream);
|
|
188
|
+
}
|
|
185
189
|
}).on('error', error => {
|
|
186
190
|
console.error('Failed to download asset');
|
|
187
191
|
console.error(error);
|