跳轉到主要內容

安裝

Find the anon key with npx @insforge/cli secrets get ANON_KEY, or in the dashboard: click Install and open API Keys.

from()

取得儲存空間貯體例項以進行檔案操作。

參數

  • bucketName (string, required) - 儲存空間貯體的名稱

傳回

範例


upload()

使用特定路徑/金鑰上傳檔案。

參數

  • path (string, required) - 檔案的物件金鑰/路徑
  • file (File | Blob, required) - 要上傳的檔案或 Blob

傳回

如果存在具有相同金鑰的檔案,後端會自動重新命名。一律使用傳回的 keyurl

範例

輸出


uploadAuto()

使用自動產生的唯一金鑰上傳檔案。

參數

  • file (File | Blob, required) - 要上傳的檔案或 Blob

傳回

範例

輸出


download()

將檔案下載為 Blob。

參數

  • path (string, required) - 要下載的物件金鑰/路徑

傳回

範例

輸出


remove()

從儲存空間刪除檔案。

參數

  • path (string, required) - 要刪除的物件金鑰/路徑

傳回

範例

輸出