From e4d7028e0f1a58da6fb9f536306f362622b36628 Mon Sep 17 00:00:00 2001 From: tenkirin <60653216+tenkirin@users.noreply.github.com> Date: Wed, 5 Nov 2025 18:24:13 +0900 Subject: [PATCH] docs(learn): correct another example code for the consumption of response body --- .../en/learn/manipulating-files/reading-files-with-nodejs.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/site/pages/en/learn/manipulating-files/reading-files-with-nodejs.md b/apps/site/pages/en/learn/manipulating-files/reading-files-with-nodejs.md index 24735b2f375c0..58141b91ec27c 100644 --- a/apps/site/pages/en/learn/manipulating-files/reading-files-with-nodejs.md +++ b/apps/site/pages/en/learn/manipulating-files/reading-files-with-nodejs.md @@ -101,6 +101,8 @@ async function downloadFile(url, outputPath) { const response = await fetch(url); if (!response.ok || !response.body) { + // consuming the response body is mandatory: https://undici.nodejs.org/#/?id=garbage-collection + await response.body?.cancel(); throw new Error(`Failed to fetch ${url}. Status: ${response.status}`); }