@ermis-network/ermis-chat-sdk 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ermis-network/ermis-chat-sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Ermis Chat SDK",
5
5
  "author": "Ermis",
6
6
  "homepage": "https://ermis.network/",
package/src/client.ts CHANGED
@@ -591,6 +591,21 @@ export class ErmisChat<ErmisChatGenerics extends ExtendableGenerics = DefaultGen
591
591
  });
592
592
  }
593
593
 
594
+ /**
595
+ * Downloads a media file as a Blob via the SDK's configured axiosInstance.
596
+ * This avoids CORS issues that arise when using `fetch()` directly from the browser,
597
+ * because axios is routed through the SDK's authenticated transport layer.
598
+ *
599
+ * @param url - The full URL of the media file to download.
600
+ * @returns A Blob of the file content.
601
+ */
602
+ async downloadMedia(url: string): Promise<Blob> {
603
+ const response = await this.axiosInstance.get(url, {
604
+ responseType: 'blob',
605
+ });
606
+ return response.data as Blob;
607
+ }
608
+
594
609
  errorFromResponse(response: AxiosResponse<APIErrorResponse>): ErrorFromResponse<APIErrorResponse> {
595
610
  let err: ErrorFromResponse<APIErrorResponse>;
596
611
  err = new ErrorFromResponse(`ErmisChat error HTTP code: ${response.status}`);