Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

binaryPreviewProtocol.ts

24 lines895 Bytes

1export const BINARY_PREVIEW_MAX_BYTES = 50 * 1024 * 1024;
2export const ARCHIVE_ENTRY_MAX_BYTES = 10 * 1024 * 1024;
3export const ARCHIVE_MAX_ENTRIES = 2048;
4export const ARCHIVE_MAX_RATIO = 200;
5export const SQLITE_PAGE_SIZE = 50;
6​
7export interface ArchiveEntry {
8 path: string;
9 size: number;
10 modified: string | null;
11 directory: boolean;
13​
14export type BinaryWorkerRequest =
15 | { type: "open"; kind: "archive" | "sqlite"; name: string; bytes: ArrayBuffer }
16 | { type: "entry"; path: string }
17 | { type: "rows"; table: string; page: number };
18​
19export type BinaryWorkerResult =
20 | { type: "error"; message: string }
21 | { type: "archive"; entries: ArchiveEntry[] }
22 | { type: "entry"; path: string; bytes: Uint8Array<ArrayBuffer> }
23 | { type: "sqlite"; tables: { name: string; count: number }[] }
24 | { type: "rows"; table: string; page: number; columns: string[]; rows: string[][] };