2.3.9 • Published 12 months ago

breeze-uploader-sdk v2.3.9

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

Breeze Uploader SDK Documentation

!IMPORTANT

  • Important Reminder: Before proceeding, ensure you have obtained your API and Secret keys. This is crucial for the successful integration of the service. Click here to get your keys.

Introduction

Breeze Uploader

The Breeze-Uploader-Sdk is a comprehensive toolkit designed to facilitate file operations such as:

  • uploading
  • fetching
  • renaming
  • deleting

    It abstracts complex API calls into simple, easy-to-use methods that can be integrated into any web application (client or server).

This SDK is built to handle various file types, including:

  • images
  • videos
  • generic files

    providing a seamless experience for developers working with file uploads and management

Installation

Installing Remix-Breeze

The SDK can be installed into your project via npm or yarn:

npm i breeze-uploader-sdk
yarn add breeze-uploader-sdk

Getting Started

To begin using the Breeze Uploader SDK, you need to have an API key provided by Breeze. This key is essential for authenticating your requests and interacting with the Breeze file management system. Get your Api Key now for free

Initialization

To use the SDK, you must first import and initialize it with your API and secret key:

import { BreezeUploader } from "breeze-uploader-sdk";

const breeze = new BreezeUploader({
  apiKey: "YOUR_API_KEY",
  secretKey: "YOUR_SECRET_KEY",
});

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,
});

Server side Upload

Upload Images

Uploads a collection of image files.

  • Arguments

    • images: An array of File objects representing the images to be uploaded.
    • 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 { BreezeUploader, BreezeFileType } from "breeze-uploader-sdk";

const breeze = new BreezeUploader({
  apiKey: "YOUR_API_KEY",
  secretKey: "YOUR_SECRET_KEY",
});

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

uploadVideos

Uploads a collection of video files.

  • Arguments

    • videos: An array of File objects representing the videos to be uploaded.
    • 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 { BreezeUploader, BreezeFileType } from "breeze-uploader-sdk";

const breeze = new BreezeUploader({
  apiKey: "YOUR_API_KEY",
  secretKey: "YOUR_SECRET_KEY",
});

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

uploadAnyFiles

Uploads a collection of files of any type.

  • Arguments
    • files: An array of File objects representing the files to be uploaded.
    • 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 { BreezeUploader, BreezeFileType } from "breeze-uploader-sdk";

const breeze = new BreezeUploader({
  apiKey: "YOUR_API_KEY",
  secretKey: "YOUR_SECRET_KEY",
});

await breeze.uploadAnyFiles({ files: Array.from(files) });

GetFileByKey

Retrieves a file details by its unique key.

  • Arguments

    • key: The unique key of the file to retrieve.
  • Returns

    • A Promise<BreezeFileType> Promise that resolves to the file's details or null if the file cannot be found.
import { BreezeUploader } from "breeze-uploader-sdk";

const breeze = new BreezeUploader({
  apiKey: "YOUR_API_KEY",
  secretKey: "YOUR_SECRET_KEY",
});

await breeze.getFileByKey({ key: "YOUR_FILE_KEY" });

GetAllFIles

Retrieves all files within a specified bucket.

  • Arguments

    • bucketName: The name of the bucket from which to retrieve files.
    • limit (optional): The maximum number of files to retrieve.
    • skip (optional): The number of files to skip (for pagination).
  • Returns

    • An array Promise<{ files:BreezeFileType[];fileCount:number; totalPages:number}> that resolves to an object containing the list of files and the total file count.
import { BreezeUploader } from "breeze-uploader-sdk";

const breeze = new BreezeUploader({
  apiKey: "YOUR_API_KEY",
  secretKey: "YOUR_SECRET_KEY",
});

await breeze.getAllFiles({ bucketName: "YOUR_BUCKET_NAME" });

renameFile

Renames a specified file.

  • Arguments

    • key: The unique key of the file to rename.
    • name: The new name for the file.
  • Returns

    • A Promise<BreezeFileType|null> that resolves to the renamed file's details or null if the operation fails.
import { BreezeUploader } from "breeze-uploader-sdk";

const breeze = new BreezeUploader({
  apiKey: "YOUR_API_KEY",
  secretKey: "YOUR_SECRET_KEY",
});

await breeze.renameFile({ key: "YOUR_FILE_KEY", name: "NEW_NAME" });

deleteFileList

Deletes a list of files specified by their keys.

  • Arguments

    • keys: An array of strings representing the keys of the files to delete.
  • Returns

    • A Promise<{deletedCount:number}> that resolves to an object containing the count of deleted files.
import { BreezeUploader } from "breeze-uploader-sdk";

const breeze = new BreezeUploader({
  apiKey: "YOUR_API_KEY",
  secretKey: "YOUR_SECRET_KEY",
});

await breeze.deleteFileList({ keys: ["YOUR_KEY",...] });
2.3.9

12 months ago

2.3.6

12 months ago

2.3.8

12 months ago

2.3.7

12 months ago

2.2.1

1 year ago

2.2.0

1 year ago

2.2.3

1 year ago

2.2.2

1 year ago

2.2.5

1 year ago

2.2.4

1 year ago

2.0.9

1 year ago

2.2.6

1 year ago

2.1.9

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.8

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago