lean-s3
    Preparing search index...

    Class S3Client

    A configured S3 bucket instance for managing files.

    // Basic bucket setup
    const bucket = new S3Client({
    bucket: "my-bucket",
    accessKeyId: "key",
    secretAccessKey: "secret"
    });
    // Get file instance
    const file = bucket.file("image.jpg");
    await file.delete();
    Index

    Constructors

    Methods

    • Creates a new bucket on the S3 server.

      Parameters

      • name: string

        The name of the bucket to create. AWS the name according to some rules. The most important ones are:

        • Bucket names must be between 3 (min) and 63 (max) characters long.
        • Bucket names can consist only of lowercase letters, numbers, periods (.), and hyphens (-).
        • Bucket names must begin and end with a letter or number.
        • Bucket names must not contain two adjacent periods.
        • Bucket names must not be formatted as an IP address (for example, 192.168.5.4).
      • Optionaloptions: BucketCreationOptions

      Returns Promise<void>

      If the bucket name is invalid.

      If the bucket could not be created, e.g. if it already exists.

      Uses CreateBucket

    • Creates an S3File instance for the given path.

      Parameters

      • path: string

        The path to the object in the bucket. Also known as object key. We recommend not using the following characters in a key name because of significant special character handling, which isn't consistent across all applications (see AWS docs):

        • Backslash (\\)
        • Left brace ({)
        • Non-printable ASCII characters (128–255 decimal characters)
        • Caret or circumflex (^)
        • Right brace (})
        • Percent character (%)
        • Grave accent or backtick (```)
        • Right bracket (])
        • Quotation mark (")
        • Greater than sign (>)
        • Left bracket ([)
        • Tilde (~)
        • Less than sign (<)
        • Pound sign (#)
        • Vertical bar or pipe (|)

        lean-s3 does not enforce these restrictions.

      • Optional_options: Partial<CreateFileInstanceOptions>

        TODO

      Returns S3File

      const file = client.file("image.jpg");
      await file.write(imageData);

      const configFile = client.file("config.json", {
      type: "application/json",
      acl: "private"
      });
    • Parameters

      Returns Promise<ListPartsResult>

      Uses ListParts.

      If key is not at least 1 character long.

      If uploadId is not provided.

      If options.maxParts is not a number.

      If options.maxParts is <= 0.

      If options.partNumberMarker is not a string.