Files
outline/server/queues/tasks/ExportHTMLZipTask.ts
T
Tom Moor 8d44a0fd92 chore: Migrate from JSZip to Yazl (#12408)
* chore: Migrate from JSZip to Yazl

* Add koa stream helper, PR feedback
2026-05-21 23:27:23 -04:00

37 lines
1007 B
TypeScript

import { ZipFile } from "yazl";
import type { NavigationNode } from "@shared/types";
import { FileOperationFormat } from "@shared/types";
import type { Collection, FileOperation } from "@server/models";
import type { Document } from "@server/models";
import ExportDocumentTreeTask from "./ExportDocumentTreeTask";
export default class ExportHTMLZipTask extends ExportDocumentTreeTask {
public async exportCollections(
collections: Collection[],
fileOperation: FileOperation
) {
const zip = new ZipFile();
return await this.addCollectionsToArchive(
zip,
collections,
FileOperationFormat.HTMLZip,
fileOperation.options?.includeAttachments ?? true
);
}
public async exportDocument(
document: Document,
documentStructure: NavigationNode[]
): Promise<string> {
const zip = new ZipFile();
return await this.addDocumentToArchive({
document,
documentStructure,
format: FileOperationFormat.HTMLZip,
zip,
});
}
}