I haven’t really tested this myself, but was wondering if someone has tried this out.
I’ve originally implemented the edgee slingshot package for file uploads.
I liked the idea of offloading the actual work from my server, so that the client uploads direct to S3.
However I need to do some image resizing, and think collectionFS is better suited because I can upload the image to the server, resize it, then save two copies to S3.
How well does Node handle larger uploads given that it would be a constant stream of data?
Does it block while the user is uploading? What happens if I have multiple people trying to upload at the one time?
Node excels at exactly these kinds of things because it is nonblocking by nature. So there’s absolutely no performance penalty or similar to be expected even if tons of uploads should be going on at the same time, even with a single node process. Your bandwidth should be exhausted long before the process gets overloaded.
EDIT: Also, there is actually the option of performing image transformations such as resizing on the client in JS using SVG and then you could still keep uploading to S3, which would still be better from a bandwidth-conservation perspective. But I haven’t tried this way in practice yet, it’s just something that’s also come up in a project and I’ve only done some initial research on it so far and don’t know if it’s actually feasible and what the downsides of that would be. Just throwing it in here as an additional idea which might be worth researching and experimenting with.
Thanks for the info, that is exactly what I was hoping to hear
I don’t think I will bother with the resizing on the client side.
I want the full res images but I also need thumbnails to show when browsing through the library.
Also as a third option there is cloudinary… You can upload from the client and then use their image transformation api to specify the photo in the exact dimension you need, as well as a many number of other things including cropping and applying filters. Another benefit is that your images are served from a CDN so they will load quite fast.
I actually did some client side cropping and downscaling before uploading the images to s3 with slingshot. It worked quite well but you’ll end up with a base64 encoded image which is usually a bit bigger in size than resizing/downscaling not in-browser.
I then still put the s3 bucket behind Cloudflare with their in-house ‘Polish’ feature enabled. It basically converted my jpg’s to progressive jpg’s with a better compression. Even though Cloudflare usually doesn’t have as great speeds as Cloudfront, I was amazingly surprised at which speed my progressive images got delivered.
Also if you’re a high resolution fanatic imgix.com got a lot of buzz lately.