-
Notifications
You must be signed in to change notification settings - Fork 117
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
Feature request: support for aws-sdk
v3
#241
Comments
Any updates on this issue? |
AFAIK the CMIIW, the SDK v3 also bumps the minimum supported node version to v10 |
I have created PR #277. Please check if any changes are required. Suggestions for test scripts are welcome, since I have yet to figure out how to implement one. |
Workaround I did that worked: const directory = await unzipper.Open.custom({
async size() {
const info = await s3.send(
new HeadObjectCommand({
Bucket: bucket,
Key: key,
}),
);
return info.ContentLength;
},
stream(offset, length) {
const stream = new PassThrough();
s3.send(
new GetObjectCommand({
Bucket: bucket,
Key: key,
Range: `bytes=${offset}-${length ?? ""}`,
}),
)
.then((response) => {
response.Body.pipe(stream);
})
.catch((error) => {
stream.emit("error", error);
});
return stream;
},
}); |
This should resolve this issue: ZJONSSON#241 I have used a variation of @Sljux's solution to make the interface compatible with the current `stream` interface.
The S3 client for v3 of the SDK signature has changed when trying to create a read stream.
The signature has changed so that instead of
node-unzipper/lib/Open/index.js
Lines 86 to 92 in 7f83183
, although it's unclear how to distinguish between a v2 client and a v3 client and if the caller would be happy with a Promise being returned instead of the stream directly.
If a v3 client is passed in, the following error is thrown in the current version of
unzipper
:The text was updated successfully, but these errors were encountered: