Skip to content

Commit c77f2db

Browse files
committed
adding new control images
1 parent 98ba000 commit c77f2db

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/images.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,35 @@ const images = [{
1313
}, {
1414
name: '0002.heic', // single image
1515
url: drive('1J_761fe_HWSijAthq7h_D2Zsf1_es1cT')
16+
}, {
17+
name: '0002-control.png', // single image control
18+
url: drive('1uomSNTAK5FifvI72lYi6T42zhvVv1LwH')
1619
}, {
1720
name: '0003.heic', // multiple images
1821
url: drive('1Iru2g084yZGz-eRagiqZgccRJZfGLYgS')
22+
}, {
23+
name: '0003-0-control.png', // multiple images control, index 0
24+
url: drive('1FZ9mJVj54MpD4c5TMfiOrarzkrT3pr2U')
25+
}, {
26+
name: '0003-1-control.png', // multiple images control, index 1, 2
27+
url: drive('1qD4-V6FcU2ffpNm0ZxKO2cpqbol73tok')
1928
}].map(img => {
2029
img.path = resolve(img.name);
2130
return img;
2231
});
2332

2433
(async () => {
2534
for (let image of images) {
35+
// we won't assume malicious intent... if the images exist, don't bother fetching them
36+
if (await fs.exists(image.path)) {
37+
continue;
38+
}
39+
2640
const { url, name } = image;
2741
const res = await fetch(url);
2842

2943
if (!res.ok) {
30-
throw new Error(`failed to download ${name} at ${url}`);
44+
throw new Error(`failed to download ${name} at ${url}: ${res.status} ${res.statusText}`);
3145
}
3246

3347
const buffer = await res.buffer();

0 commit comments

Comments
 (0)