Skip to content

Usage example for custom source #337

@abhemanyus

Description

@abhemanyus

The unzip.Open.s3 function does not support s3 clients like minio, forcing the user to fall back on the custom source implementation.
There is an example for google cloud storage, but none for Minio.

A simple example can be added to the docs:

  const customSource = {
    stream: function(offset: number, length: number) {
      const pass = new PassThrough();
      minioClient.getPartialObject(
        S3_BUCKET_NAME,
        key,
        offset,
        length
      )
        .then(stream => stream.pipe(pass));
      return pass;
    },
    size: async function() {
      const objMetadata = await minioClient.statObject(S3_BUCKET_NAME, key);
      return objMetadata.size;
    }
  };
  const directory = await unzipper.Open.custom(customSource);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions