I am streaming files from S3 and through my API to the client in order to enforce access control rules. In doing so, I need to set the content-type header appropriately. Does anyone know of a way to get the content-type from S3 without making a separate call to headObject? Right now I have to first get the object metadata and then make another request to get the object stream.
EDIT: To clarify, I'm using
return s3.getObject(params).createReadStream();
to get the stream, so there is no callback that I'm aware of.