Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MinioProvider

Client to interact with Minio. It is based on the GenericS3 Provider class.

Hierarchy

  • GenericS3Provider
    • MinioProvider

Index

Constructors

constructor

  • new MinioProvider(connection: MinioClientOptions): MinioProvider
  • Initializes a new client to interact with Minio.

    Parameters

    • connection: MinioClientOptions

      Dictionary with connection options.

    Returns MinioProvider

Properties

Protected _client

_client: MinioClient

Protected _provider

_provider: string

client

client: any

Returns an instance of the client object, to interact with the cloud provider directly

returns

Client object

provider

provider: string

Returns the name of the provider

returns

Provider name

Methods

createContainer

  • createContainer(container: string, options?: any): Promise<void>
  • Create a container ("bucket") on the server.

    async

    Parameters

    • container: string

      Name of the container

    • Optional options: any

      The option argument is ignored by this provider.

    Returns Promise<void>

    Promise that resolves once the container has been created. The promise doesn't contain any meaningful return value.

deleteContainer

  • deleteContainer(container: string): Promise<void>
  • Removes a container from the server

    async

    Parameters

    • container: string

      Name of the container

    Returns Promise<void>

    Promise that resolves once the container has been removed

deleteObject

  • deleteObject(container: string, path: string): Promise<void>
  • Removes an object from the server

    async

    Parameters

    • container: string

      Name of the container

    • path: string

      Path of the object, inside the container

    Returns Promise<void>

    Promise that resolves once the object has been removed

ensureContainer

  • ensureContainer(container: string, options?: any): Promise<void>
  • Create a container ("bucket") on the server if it doesn't already exist.

    async

    Parameters

    • container: string

      Name of the container

    • Optional options: any

      The option argument is ignored by this provider.

    Returns Promise<void>

    Promise that resolves once the container has been created

getObject

  • getObject(container: string, path: string): Promise<Stream>
  • Requests an object from the server. The method returns a Promise that resolves to a Readable Stream containing the data.

    async

    Parameters

    • container: string

      Name of the container

    • path: string

      Path of the object, inside the container

    Returns Promise<Stream>

    Readable Stream containing the object's data

getObjectAsBuffer

  • getObjectAsBuffer(container: string, path: string): Promise<Buffer>
  • Requests an object from the server. The method returns a Promise that resolves to a Buffer object containing the data from the server.

    async

    Parameters

    • container: string

      Name of the container

    • path: string

      Path of the object, inside the container

    Returns Promise<Buffer>

    Buffer containing the object's data

getObjectAsString

  • getObjectAsString(container: string, path: string, encoding?: string): Promise<string>
  • Requests an object from the server. The method returns a Promise that resolves to a string containing the data from the server.

    async

    Parameters

    • container: string

      Name of the container

    • path: string

      Path of the object, inside the container

    • Optional encoding: string

      Optional encoding for the string; defaults to utf8

    Returns Promise<string>

    String containing the object's data

isContainer

  • isContainer(container: string): Promise<boolean>
  • Check if a container exists.

    async

    Parameters

    • container: string

      Name of the container

    Returns Promise<boolean>

    Promises that resolves with a boolean indicating if the container exists.

listContainers

  • listContainers(): Promise<string[]>
  • Lists all containers belonging to the user

    async

    Returns Promise<string[]>

    Promise that resolves with an array of all the containers

listObjects

  • listObjects(container: string, prefix?: string): Promise<ListResults>
  • Returns a list of objects with a given prefix (folder). The list is not recursive, so prefixes (folders) are returned as such.

    async

    Parameters

    • container: string

      Name of the container

    • Optional prefix: string

      Prefix (folder) inside which to list objects

    Returns Promise<ListResults>

    List of elements returned by the server

presignedGetUrl

  • presignedGetUrl(container: string, path: string, ttl?: number): Promise<string>
  • Returns a URL that clients (e.g. browsers) can use to request an object from the server with a GET request, even if the object is private.

    async

    Parameters

    • container: string

      Name of the container

    • path: string

      Path of the object, inside the container

    • Optional ttl: number

      Expiry time of the URL, in seconds (default: 1 day)

    Returns Promise<string>

    Promise that resolves with the pre-signed URL for GET requests

presignedPutUrl

  • presignedPutUrl(container: string, path: string, options?: any, ttl?: number): Promise<string>
  • Returns a URL that clients (e.g. browsers) can use for PUT operations on an object in the server, even if the object is private.

    async

    Parameters

    • container: string

      Name of the container

    • path: string

      Path where to store the object, inside the container

    • Optional options: any

      This argument is ignored by the GenericS3 provider

    • Optional ttl: number

      Expiry time of the URL, in seconds (default: 1 day)

    Returns Promise<string>

    Promise that resolves with the pre-signed URL for GET requests

putObject

  • putObject(container: string, path: string, data: Stream | string | Buffer, options?: PutObjectOptions): Promise<void>
  • Uploads a stream to the object storage server

    async

    Parameters

    • container: string

      Name of the container

    • path: string

      Path where to store the object, inside the container

    • data: Stream | string | Buffer

      Object data or stream. Can be a Stream (Readable Stream), Buffer or string.

    • Optional options: PutObjectOptions

      Key-value pair of options used by providers, including the metadata dictionary

    Returns Promise<void>

    Promise that resolves once the object has been uploaded

Generated using TypeDoc