Menu

1 / 2

Node.js Avatar Pipeline: Upload, Resize Three Sizes, Store IDs Atomically

DEV Community: express·JamesAnderson121·4 days ago
#uN5N457q
#devtoexpress#devto#dev#upload#path
Long article (1768 words) — no AI summary yet.
Reading 0:00
15s threshold

TL;DR: For an edtech profile service, process learner photos at upload time: upload once, make the safety decision before publication, derive the three sizes the interface renders, and atomically replace the IDs on the user record. Store asset IDs, never delivery URLs. On-demand processing is better only when variants are unpredictable or most uploads are never viewed.

This is a reliability choice. A profile page should never discover, during a student login spike, that it still needs to inspect and resize an avatar. The write path can do more work because the read path is frequent and visible; until that work completes, the old approved photo remains active.

One boundary owns the transition: unreviewed upload in, complete approved asset set out. Nothing partial gets published.

How should Node.js upload an avatar and resize three sizes?

The plain-language flow is short. Express receives a file and sends it to an image service. Upload returns an ID, and every later operation starts from that ID.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.