diff --git a/main.ts b/main.ts index a6cb048..49623a9 100644 --- a/main.ts +++ b/main.ts @@ -1,3 +1,6 @@ +import fs from "node:fs/promises"; +import os from "node:os"; +import path from "node:path"; import util from "node:util"; import { createBrowser } from "./browser"; import { createDatabase } from "./database"; @@ -174,7 +177,9 @@ const options = { db, browser, }); - const dir = `${args.values["out-dir"]!}/${book.id}`; + const dir = await fs.mkdtemp( + path.join(os.tmpdir(), `gadl-${book.id}-`), + ); await platform.download(dir, book); await library.archive(dir, book, { outDir: args.values["out-dir"]!, diff --git a/package-lock.json b/package-lock.json index 1891f64..0b9824a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@fogtype/gadl", - "version": "1.3.1", + "version": "1.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@fogtype/gadl", - "version": "1.3.1", + "version": "1.4.0", "license": "AGPL-3.0", "dependencies": { "fflate": "^0.8.1", diff --git a/package.json b/package.json index 2abd57a..eb6a802 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fogtype/gadl", - "version": "1.3.1", + "version": "1.4.0", "license": "AGPL-3.0", "type": "module", "bin": "bin/run.js", diff --git a/platform.ts b/platform.ts index baf5a1c..0de2fca 100644 --- a/platform.ts +++ b/platform.ts @@ -44,7 +44,6 @@ export function createPlatform(opts: { ...platform, async download(dir: string, book: Book): Promise { - await fs.mkdir(path.dirname(dir), { recursive: true }); await fs.mkdir(dir); const files: Array<() => Promise> = await platform.getFiles(book);