Skip to content

Commit e97a886

Browse files
committed
add module to copy from paths
1 parent 26bf1de commit e97a886

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ items.json
66
item_presets.json
77
spt_presets.json
88
presets.json
9-
.env
9+
paths.json
10+
.env

copy-from-paths.mjs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import fs from 'node:fs';
2+
import path from 'node:path';
3+
4+
const paths = JSON.parse(fs.readFileSync('paths.json'));
5+
6+
const imagesPath = './images';
7+
8+
if (!fs.existsSync(imagesPath)){
9+
fs.mkdirSync(imagesPath);
10+
}
11+
12+
for (const id in paths) {
13+
fs.copyFileSync(paths[id], path.join(imagesPath, `${id}.png`));
14+
}

0 commit comments

Comments
 (0)