Recently, I've been exploring how to build a live reload server from scratch (keep an eye out for a future post on this). During this exploration, I had to figure out how to inject HTML into the payload of a fastify static file server (@fastify/static
) response. My solution utilizes the Node.js Buffer API and a custom Node.js Transform stream. Let's dive in!