MCPcopy
hub / github.com/appwrite/sdk-for-react-native / getFileDownloadURL

Method getFileDownloadURL

src/services/storage.ts:713–729  ·  view source on GitHub ↗

* Get a file content by its unique ID. The endpoint response return with a * 'Content-Disposition: attachment' header that tells the browser to start * downloading the file to user downloads directory. * * @param {string} bucketId * @param {string} fileId * @param {stri

(bucketId: string, fileId: string, token?: string)

Source from the content-addressed store, hash-verified

711 * @returns {URL}
712 */
713 getFileDownloadURL(bucketId: string, fileId: string, token?: string): URL {
714 const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
715 const payload: Payload = {};
716
717 if (typeof token !== 'undefined') {
718 payload['token'] = token;
719 }
720
721 const uri = new URL(this.client.config.endpoint + apiPath);
722 payload['project'] = this.client.config.project;
723
724 for (const [key, value] of Object.entries(Service.flatten(payload))) {
725 uri.searchParams.append(key, value);
726 }
727
728 return uri;
729 }
730
731 /**
732 * Get a file preview image. Currently, this method supports preview for image

Callers

nothing calls this directly

Calls 1

flattenMethod · 0.80

Tested by

no test coverage detected