UNPKG

@squarecloud/blob

Version:
74 lines (70 loc) 1.85 kB
import { APIManager } from './managers/api.js'; import { BlobObject } from './structures/object.js'; import { CreateObjectType } from './types/create.js'; import { ListObjectsType } from './types/list.js'; import './utils/mimetype/index.js'; import './utils/mimetype/mimetypes.js'; import './utils/mimetype/enum.js'; declare class ObjectsManager { private readonly client; constructor(client: SquareCloudBlob); /** * Lists all objects in the storage. * * @example * ```js * blob.objects.list(); * ``` */ list(options?: ListObjectsType): Promise<BlobObject[]>; /** * Uploads an object to the storage. * * @param object - An object to upload * * @example * ```js * // Basic usage with absolute path * blob.objects.create({ * file: "path/to/file.jpeg", * name: "my_image" * }); * * // Advanced usage with Buffer * blob.objects.create({ * file: Buffer.from("content"), * name: "my_image", * mimeType: "image/jpeg" * }) * ``` */ create(object: CreateObjectType): Promise<BlobObject>; /** * Delete an object from the storage. * * @param object - An array of object IDs * * @example * ```js * blob.object.delete("userId/prefix/name1_xxx-xxx.mp4"); * ``` */ delete(object: string): Promise<boolean>; } declare class SquareCloudBlob { static apiInfo: { baseUrl: string; version: string; }; readonly api: APIManager; readonly objects: ObjectsManager; constructor(apiKey: string); stats(): Promise<{ objects: number; size: number; storagePrice: number; objectsPrice: number; totalEstimate: number; }>; } export { ObjectsManager as O, SquareCloudBlob as S };