Back to feed
Dev.to
Dev.to
7/13/2026
Large PDFs in Node.js Without Unbounded Buffering

Large PDFs in Node.js Without Unbounded Buffering

Short summary

A practical guide for handling large PDFs in Node.js production environments, addressing V8 heap exhaustion, Vercel body size limits, and event loop blocking from Buffer.concat. The recommended pattern decouples upload from analysis using presigned URLs to object storage, keeping bytes out of the Node worker entirely. Covers concurrency strategies across Vercel, Fly.io, Coolify, and self-hosted Fastify.

  • Naive FormData-to-buffer pattern fails in production: heap exhaustion, 413 errors, event loop blocking
  • Solution: browser uploads directly to object storage via presigned URL, server only processes the stored file
  • Assume 3-5x raw PDF size in transient allocation per in-flight request when sizing workers

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more