@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
31 lines • 1.24 kB
TypeScript
export interface DiscordAttachment {
id: string;
filename?: string;
title?: string;
url?: string;
proxy_url?: string;
content_type?: string;
size?: number;
}
/**
* Whether a day's `files` directory lists an attachment.
*
* Tombstoned (deleted) and access-restricted attachment payloads carry an id
* but no download URL and no byte size; read() ENOENTs on them, so listing
* them would surface phantom files with unknown sizes. Mirrors the slack guard.
*/
export declare function isListed<T extends Record<string, unknown>>(att: T): att is T & {
id: string;
url: string;
size: number;
};
/**
* Construct a stable VFS filename for a Discord attachment, of shape
* `<stem>__<att-id>.<ext>`, named after `filename` and else `title` (see
* `fileIdName`).
*/
export declare function fileBlobName(att: DiscordAttachment): string;
export declare function downloadFile(url: string, offset?: number, size?: number | null, timeout?: number): Promise<Uint8Array>;
/** Stream an attachment with bounded reads and response cleanup. */
export declare function downloadFileStream(url: string, signal?: AbortSignal, timeout?: number): AsyncGenerator<Uint8Array, void>;
//# sourceMappingURL=files.d.ts.map