u/kernelangus420

▲ 23 r/node

Is it common to have any async processes finish in the background while the main function returns a value early or should one avoid it strictly and stick with job queues?

How strictly should I avoid a Node/Express handler returning a value to the client, but have some process continue in the background to finish processing it?

If the background is expected to take another 1~2 seconds is it acceptable?

Or should I avoid them and relegate all background tasks, big or small, to a dedicated job queue at the cost of complexity.

reddit.com
u/kernelangus420 — 5 days ago
▲ 11 r/webdev

Client side image resizing is simple (uses Canvas and toBlob) and saves bandwidth, why aren't more people doing it?

Advantages:

  • Naturally supports all the image formats that the device's camera supports (e.g HEIC) and converts it to universal PNG or WEBP.
  • Resizes the image to smaller size which saves bandwidth.
  • Bonus: Create multiple image sizes too and upload all of them so you don't have to do it on the server.
  • If you're doing it anyway, might as well support client cropping and rotating.

Disadvantages:

  • More code on the client app, although handing canvas is really small since most of it is done natively
  • You loose the EXIF data unless you process it specifically
  • If you do resize to multiple sizes and upload separately you use more bandwidth and you have to trust the uploader didn't fudge the different dimensions
  • Doesn't support old browsers
reddit.com
u/kernelangus420 — 19 days ago