mod-build 4.0.106-beta.1 → 4.0.106-beta.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.
package/package.json
CHANGED
|
@@ -99,6 +99,7 @@ async function downloadImage(url) {
|
|
|
99
99
|
// first check if the image already exists in public/assets folder
|
|
100
100
|
const imagePath = path.join(defaultSettings.publicFolder, defaultSettings.assetsSubfolder, url);
|
|
101
101
|
if (fs.existsSync(imagePath)) {
|
|
102
|
+
console.log(`Image ${url} already exists`);
|
|
102
103
|
return null;
|
|
103
104
|
}
|
|
104
105
|
// download the image and put in imagePath
|
|
@@ -112,8 +113,8 @@ async function downloadImage(url) {
|
|
|
112
113
|
const buffer = Buffer.from(await response.arrayBuffer());
|
|
113
114
|
fs.mkdirSync(path.dirname(imagePath), { recursive: true });
|
|
114
115
|
fs.writeFileSync(imagePath, buffer);
|
|
115
|
-
console.log(`Downloaded image ${url}
|
|
116
|
-
return
|
|
116
|
+
console.log(`Downloaded image ${url}`);
|
|
117
|
+
return imagePath;
|
|
117
118
|
} catch (error) {
|
|
118
119
|
console.error(`Error downloading image ${url}: ${error}`);
|
|
119
120
|
throw new Error(`Error downloading image ${url}: ${error}`);
|