-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (24 loc) · 824 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const fs = require('fs');
const path = require('path');
const { zip } = require('zip-a-folder');
const dir = '\osu!\\Songs'; //osu songs path here
const exportdir = './maps/';
let progress = 0;
fs.readdir(dir, async function(err, files) {
const amount = files.length;
if (err) throw err;
for (const file of files) {
const filepath = path.join(dir, file);
await new Promise((resolve, reject) => {
fs.stat(filepath, async function(err, stats) {
if (err) reject();
if (stats.isDirectory()) {
await zip(filepath, `${exportdir}${file}.osz`);
progress++;
console.log(`${progress} / ${amount} | ${file}`);
resolve();
}
});
});
};
});