Files
outline/server/queues/tasks/ExportMarkdownZipTask.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
1011 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 ExportMarkdownZipTask extends ExportDocumentTreeTask {
public async exportCollections(
collections: Collection[],
fileOperation: FileOperation
) {
const zip = new ZipFile();
return await this.addCollectionsToArchive(
zip,
collections,
FileOperationFormat.MarkdownZip,
fileOperation.options?.includeAttachments
);
}
public async exportDocument(
document: Document,
documentStructure: NavigationNode[]
): Promise<string> {
const zip = new ZipFile();
return await this.addDocumentToArchive({
document,
documentStructure,
format: FileOperationFormat.MarkdownZip,
zip,
});
}
}