Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage example for custom source #337

Open
abhemanyus opened this issue Aug 14, 2024 · 0 comments
Open

Usage example for custom source #337

abhemanyus opened this issue Aug 14, 2024 · 0 comments

Comments

@abhemanyus
Copy link

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant