I'm running a Node app on a server and using S3 for all the file storage. When uploading a video file, it's sent directly from the browser to the S3 store, and then I run a Node function to generate the thumbnail, reading the file from S3 to Node, generating the thumbnail and writing the resulting file back to S3 without ever saving it locally on the app server.
I'm trying to use thumbsupply to generate previews for video files, but can't get the syntax right for returning the thumb as a buffer that can be passed into the s3.putObject function.
I'm not sure if the error being returned is from the input to thumbsupply being in the wrong form, or the resulting generated thumb not being the right form (a Buffer) for s3.putObject.
s3.getObject({ Bucket: myBucket, Key: sourceFilename })
.promise()
.then(data => thumbsupply.generateThumbnail(data.body,
{
size: thumbsupply.ThumbSize.MEDIUM,
mimetype: "video/mp4"
})
)
.then(buffer => s3.putObject({
Body: buffer,
Bucket: myBucket,
ContentType: 'image/jpeg',
Key: destinationFilename,
ACL: 'public-read-write'
})
Can you shed some light on what I'm missing here?
Thanks!
I'm running a Node app on a server and using S3 for all the file storage. When uploading a video file, it's sent directly from the browser to the S3 store, and then I run a Node function to generate the thumbnail, reading the file from S3 to Node, generating the thumbnail and writing the resulting file back to S3 without ever saving it locally on the app server.
I'm trying to use thumbsupply to generate previews for video files, but can't get the syntax right for returning the thumb as a buffer that can be passed into the s3.putObject function.
I'm not sure if the error being returned is from the input to thumbsupply being in the wrong form, or the resulting generated thumb not being the right form (a Buffer) for s3.putObject.
Can you shed some light on what I'm missing here?
Thanks!