On this page

Client side Upload

Before using the client-side upload feature, you must first obtain a oneTimeToken from the server.

  • Here is how to get the oneTimeToken from the server:

    import { BreezeUploader } from "breeze-uploader-sdk";
    
    const breeze = new BreezeUploader({
      apiKey: "YOUR_API_KEY",
      secretKey: "YOUR_SECRET_KEY",
    });
    const { token } = await breeze.getOneTimeToken();
    
    • Returns
      • A Promise<{token:string|null}>. returns null if there is an error with your apiKey or secretKey.

Upload Images

Uploads a collection of image files.

  • Arguments

    • images: An array of File objects representing the images to be uploaded.
    • oneTimeToken: The token you get from the server.
    • maxSize (optional): The maximum files size allowed.
    • maxFileCount (optional): The maximum number of images allowed to be uploaded in a single operation.
  • Returns

    • A Promise<{ files:BreezeFileType[]; error:string|null }> that resolves to an object containing information about the upload process, including completion and error details.
import { BreezeClientUploader, BreezeFileType } from "breeze-uploader-sdk";

const breeze = new BreezeClientUploader();

await breeze.uploadImages({
  images: Array.from(files),
  oneTimeToken,
});

uploadVideos

Uploads a collection of video files.

  • Arguments

    • videos: An array of File objects representing the videos to be uploaded.
    • oneTimeToken: The token you get from the server.
    • maxSize (optional): The maximum files size allowed.
    • maxFileCount (optional): The maximum number of videos allowed to be uploaded in a single operation.
  • Returns

    • A Promise<{ files:BreezeFileType[]; error:string|null }> that resolves to an object containing information about the upload process, including completion and error details.
import { BreezeClientUploader, BreezeFileType } from "breeze-uploader-sdk";

const breeze = new BreezeClientUploader();

await breeze.uploadVideos({
  videos: Array.from(files),
  oneTimeToken,
});

uploadAnyFiles

Uploads a collection of files of any type.

  • Arguments

    • files: An array of File objects representing the files to be uploaded.
    • oneTimeToken: The token you get from the server.
    • maxSize (optional): The maximum files size allowed.
    • maxFileCount (optional): The maximum number of files allowed to be uploaded in a single operation.
  • Returns

    • A Promise<{ files:BreezeFileType[]; error:string|null }> that resolves to an object containing information about the upload process, including completion and error details.
import { BreezeClientUploader, BreezeFileType } from "breeze-uploader-sdk";

const breeze = new BreezeClientUploader();

await breeze.uploadAnyFiles({
  files: Array.from(files),
  oneTimeToken,
});
Docs and examples licensed under MIT