stream-chat-react
Version:
React components to create chat conversations or livestream style chat
25 lines • 1.22 kB
TypeScript
import { type LocalUploadAttachment } from 'stream-chat';
/**
* Download behavior notes:
*
* - Remote attachments prefer `fetch -> blob -> objectURL` instead of direct link clicks.
* - In Chromium, direct sequential clicks on cross-origin URLs can yield only one actual
* downloaded file even when multiple anchor clicks are fired.
* - Blob URLs are same-document downloads and preserve caller-provided `a.download` names
* more reliably than direct remote URLs.
* - If remote fetch fails (e.g. CORS/policy/network), the code falls back to direct URL
* download so the action remains functional.
*/
export type DownloadableAttachment = {
asset_url?: string;
image_url?: string;
localMetadata?: LocalUploadAttachment['localMetadata'];
title?: string;
};
export declare const isDownloadableAttachment: (attachment: unknown) => attachment is DownloadableAttachment;
export declare const downloadAttachment: (attachment: DownloadableAttachment, options?: {
openRemoteInNewTab?: boolean;
preferRemoteFetch?: boolean;
}) => Promise<void>;
export declare const downloadAllAttachments: (attachments: DownloadableAttachment[]) => Promise<void>;
//# sourceMappingURL=downloadUtils.d.ts.map