I have images stored in Amazon S3. Image types include jpg, png and svg. I have a typescript node backend where I should retrieve an image from S3 bucket to be rotated with Sharp library. I'm using aws-sdk to get the object, but I'm having problems understanding what I can do to the S3 object to get it to a form that can be used with Sharp.
const getRequest: S3.GetObjectRequest = {
Bucket: config.aws.bucketName,
Key: uuid
};
const response = await s3client.getObject(getRequest).promise();
const macigalForm = response.Body as ???; // From documentation: Body = Readable | ReadableStream | Blob
sharp(magicalForm); // Accepts: Buffer | Uint8Array | Uint8ClampedArray | Int8Array |
// Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array | Float64Array | string
I would need help with understanding what would be the best type for "magicalForm" to be fed to sharp input.