squishjs 1.0.10 → 1.0.11

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 +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squishjs",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "squish & unsquish stuff",
5
5
  "scripts": {
6
6
  "test": "node testRunner.js"
package/src/Asset.js CHANGED
@@ -157,14 +157,17 @@ class Asset {
157
157
  const filePath = `${path}/${fileHash}`;
158
158
 
159
159
  const writeStream = this.fs.createWriteStream(filePath);
160
- const getModule = this.https;
161
160
 
162
161
  writeStream.on('close', () => {
163
162
  resolve(filePath);
164
163
  });
165
164
 
166
165
  let data = '';
167
- getModule.get(`https://assets.homegames.io/${assetId}`, (res) => {
166
+ const assetSource = this.info?.source? || 'https://assets.homegames.io';
167
+
168
+ const getModule = assetSource.startsWith('https') ? this.https : this.http;
169
+
170
+ getModule.get(`${assetSource}/${assetId}`, (res) => {
168
171
  res.on('data', (chunk) => {
169
172
  data += chunk;
170
173
  writeStream.write(chunk);