Topic: node.js

2026-09-12 · 2 min read

Resize, crop and compose images with sharp

Practical sharp recipes from a publishing pipeline: resizing a generated image to the exact sizes stores require, extracting a region to remove a border, compositing an SVG overlay with text and gradients, and JPEG settings that keep web images small without visible loss.

sharpimagesnode.jsjpeg
2026-09-12 · 2 min read

PDF from HTML with headless Chrome

Use the Chrome binary you already have to turn an HTML file into a print-ready PDF or a pixel-exact PNG, without installing Puppeteer: the flags, a throwaway user-data-dir so you never touch the real profile, @page CSS for A5 books, page-break rules, and the file URL escaping that bites on Windows.

pdfchromeheadlessnode.js
2026-09-12 · 2 min read

CRLF line endings on Windows and Node

Git Bash tools on Windows read files in text mode and hide carriage returns, so grep reports zero CRLFs in a CRLF file and string replacements that span lines never match. How to detect line endings reliably with Node, and a read-normalise-replace-restore pattern that keeps files consistent.

windowsgitline endingscrlf
2026-09-12 · 2 min read

Build an EPUB from Markdown with Node.js

Generate a valid EPUB 3 from a folder of Markdown chapters using marked and jszip: the required files, why mimetype must be stored uncompressed and first, converting HTML to XHTML, the nav.xhtml table of contents, content.opf metadata, and adding a cover.

epubmarkdownnode.jsjszip
2026-09-12 · 2 min read

Deploy Express to Cloud Run from source

A minimal, production-ready way to run an Express app on Cloud Run: the Dockerfile, reading PORT, a deploy script in package.json, scaling to zero with a small memory limit, and the mistakes that cost the first hour.

cloud runexpressnode.jsdocker

← Guides