File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
apps/site/pages/en/learn/manipulating-files Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -97,15 +97,15 @@ import { pipeline } from 'node:stream/promises';
97
97
const fileUrl = ' https://www.gutenberg.org/files/2701/2701-0.txt' ;
98
98
const outputFilePath = path .join (process .cwd (), ' moby.md' );
99
99
100
- async function downloadFile (url , outoutPath ) {
100
+ async function downloadFile (url , outputPath ) {
101
101
const response = await fetch (url);
102
102
103
103
if (! response .ok || ! response .body ) {
104
104
throw new Error (` Failed to fetch ${ url} . Status: ${ response .status } ` );
105
105
}
106
106
107
- const fileStream = fs .createWriteStream (outoutPath );
108
- console .log (` Downloading file from ${ url} to ${ outoutPath } ` );
107
+ const fileStream = fs .createWriteStream (outputPath );
108
+ console .log (` Downloading file from ${ url} to ${ outputPath } ` );
109
109
110
110
await pipeline (response .body , fileStream);
111
111
console .log (' File downloaded successfully' );
You can’t perform that action at this time.
0 commit comments