I'm trying to resize a file in node using gm.js and use the .stream()
to create a readable stream of the resized image. Now I want to upload it using knox.js .putStream()
but Content-Length
is a required header. Is it possible to identify the size of the readable stream so I can use it in the Content-Length
header?
Thanks in advance guys.
If your files aren't too large, you could bufferize your stream using raw-body module before uploading it to S3:
If your files are extremely large, it may be better to use mscdex's solution with knox-mpu module.