How to stream file from s3 to client using node.js #6515
Unanswered
waikiki-bn
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
User case:
I made a solution with V2, but i didn't make it, using V3.
download.js
`
const response = await fetch(nodeJSRoute)
const handle = await showSaveFilePicker({
suggestedName
})
const writableStream = await handle.createWritable()
await response.body?.pipeTo(writableStream)
`
S3Client.js
`
this.s3 = new AWS.S3(someConfig)
public downloadAttachment = (input: AWS.S3.GetObjectRequest): internal.Readable => {
return this.s3.getObject(input).createReadStream()
}
`
Node.JS
`
const input = {
Bucket: "bucket",
Key: "key"
}
try {
const fileObjectReadStream = s3Client.downloadAttachment(input)
} catch (error) {
response.status(500).send(error.message)
}
`
How can i make same solution but with aws-sdk v3?
Beta Was this translation helpful? Give feedback.
All reactions