/** * TUS Protocol Handler * * Implements the TUS v1.0.0 resumable upload protocol with the * Creation and Termination extensions. Uploads are stored in a * temporary directory and moved to final storage on completion. * * @see https://tus.io/protocols/resumable-upload */ import type { Context } from "hono"; import type { StorageController } from "./types"; import type { StorageRegistry } from "./storage-registry"; /** * TUS resumable upload handler. * * Each instance manages uploads for a single storage root. The * `storageController` is used to finalize completed uploads by * calling `putObject`. */ export declare class TusHandler { private storageController?; private storageRegistry?; private uploads; private tusDir; private cleanupTimer?; constructor(storageBaseDir: string, storageController?: StorageController | undefined, storageRegistry?: StorageRegistry | undefined); /** Ensure the temp directory exists. */ private ensureDir; /** Start periodic cleanup of stale uploads. */ startCleanup(): void; /** Remove uploads that have been idle for longer than UPLOAD_EXPIRY_MS. */ private cleanupStale; /** * Parse the `Upload-Metadata` header. * * Format: `key base64value,key2 base64value2` */ private parseMetadata; /** `OPTIONS /tus` — TUS capability discovery. */ options(): Response; /** `POST /tus` — Create a new upload. */ create(c: Context): Promise; /** `HEAD /tus/:id` — Query upload progress. */ head(c: Context, id: string): Response; /** `PATCH /tus/:id` — Append data to an upload. */ patch(c: Context, id: string): Promise; /** `DELETE /tus/:id` — Cancel and remove an upload. */ delete(c: Context, id: string): Promise; /** * Move a completed upload into the storage controller. */ private finalize; }