Replies: 1 comment 2 replies
-
I would recommend using using so: import fs from 'node:fs/promises'
import path from 'node:path'
for await (const url of files) {
const res = await fetch(url)
const cd = res.headers.get('content-disposition')
// figure out if the file name is in the content-disposition header and parse that instead
// or use url's basename
filename = path.basename(url)
await fs..writeFile(filename, res.body)
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is there any example on how we can download remote files to my machine?
For example, I have an array of remote files i need to download:
I want to download them to my machine with the same file name and extension.
How can i implement this?
Which function do i need to use?
Dispatcher.request
,Dispatcher.stream
orDispatcher.pipeline
A small example would help a lot.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions