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}`); }