Files
outline/server/queues/tasks/ExportTextBundleZipTask.ts
T
000f2f98fb feat: Add TextPack (.textpack) support (#13235)
* feat: Add TextPack (.textpack) import support

Adds a single-document importer for TextPack, the zipped variant of
TextBundle used by Bear, Ulysses, iA Writer and others. Bare .textbundle
directories are not supported, as a directory cannot be delivered through
a browser file input.

The bundle's text entry may use any extension, per the spec, with
info.json's type deciding whether it can be read as markdown. Assets are
inlined as data URIs for the existing attachment pipeline to pick up,
bounded by the attachment size limit and a memory ceiling, and only for
media types markdown-it accepts as a link destination.

Also fixes an existing bug where a file embedded in an HTML or email
import as a data URI was stored in the document as base64 rather than
being uploaded as an attachment.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Refactor to individual converters

* refactor

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-02 20:42:05 -04:00

32 lines
958 B
TypeScript

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 ExportTextBundleZipTask extends ExportDocumentTreeTask {
public async exportCollections(
collections: Collection[],
fileOperation: FileOperation
) {
return await this.addCollectionsToArchive(
collections,
FileOperationFormat.TextBundleZip,
fileOperation.options?.includeAttachments
);
}
public async exportDocument(
document: Document,
documentStructure: NavigationNode[],
includeAttachments: boolean
): Promise<string> {
return await this.addDocumentToArchive({
document,
documentStructure,
format: FileOperationFormat.TextBundleZip,
includeAttachments,
});
}
}