fixed out-dir problem

This commit is contained in:
Nebel 2023-12-24 23:09:32 +09:00
parent bf83e1cf0b
commit 9479741b75
Signed by: nebel
GPG key ID: 79807D08C6EF6460
2 changed files with 9 additions and 4 deletions

View file

@ -107,6 +107,10 @@ on conflict(reader_url)
book.title
}`.replace(/[/]/g, "%2F");
await fs.mkdir(opts.outDir, {
recursive: true,
});
const files = await fs.readdir(path);
if (files.every((f) => f.match(/[.](zip|cbz)$/))) {
@ -117,14 +121,15 @@ on conflict(reader_url)
}
for (const [n, f] of Object.entries(files)) {
await fs.rename(
await fs.copyFile(
`${path}/${f}`,
`${opts.outDir}/${title}${
files.length > 1 ? ` - ${pad(n)}` : ""
}.${f.split(".").at(-1)}`,
);
}
await fs.rmdir(path);
await fs.rm(path, { recursive: true });
return;
}

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "@fogtype/gadl",
"version": "1.4.1",
"version": "1.4.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@fogtype/gadl",
"version": "1.4.1",
"version": "1.4.2",
"license": "AGPL-3.0",
"dependencies": {
"fflate": "^0.8.1",