Load individual files from zip files on S3 without downloading the entire zip using range parameters.
npm install s3-range-zip
const reader = new S3RangeZip();
const fileList = await reader.fetchFileList('bucket', 'key');
console.log(fileList);
const file = await reader.downloadFile('bucket', 'key', 'myfile.txt', {encoding: 'utf8'})
console.log(file);
-
s3UrlFun
<function>
Optionally, pass a function to use a custom URL scheme.Default:
(bucketName, key) => `https://${bucketName}.s3.amazonaws.com/${key}`
bucketName
<string>
S3 Bucket namekey
<string>
S3 Item key
Returns the list of files in the zip.
bucketName
<string>
S3 Bucket namekey
<string>
S3 Item keyfileName
<string>
Name of file inside the zip to download and decompressoptions
<object>
Optional
Option Name | Type | Description |
---|---|---|
encoding |
string | utf8 to return string instead of default Uint8Array |
onProgress(receivedBytes, totalBytes) |
function | receive updates during download |
Returns the decompressed file contents as Uint8Array or string.
MIT