use mkdtemp
This commit is contained in:
parent
ce0fc9001e
commit
445110c552
4 changed files with 9 additions and 5 deletions
7
main.ts
7
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"]!,
|
||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -44,7 +44,6 @@ export function createPlatform(opts: {
|
|||
...platform,
|
||||
|
||||
async download(dir: string, book: Book): Promise<void> {
|
||||
await fs.mkdir(path.dirname(dir), { recursive: true });
|
||||
await fs.mkdir(dir);
|
||||
|
||||
const files: Array<() => Promise<Blob>> = await platform.getFiles(book);
|
||||
|
|
Loading…
Add table
Reference in a new issue