Replies: 1 comment 2 replies
-
Something like this (untested): import ky from 'ky';
import {writeFile} from 'fs/promises';
async function downloadFiles(fileNames, downloadUrl) {
await Promise.all(
fileNames.map(async fileName => {
const file = await ky.get(`${downloadUrl}/${fileName}`).bytes();
await writeFile(fileName, file);
})
);
}
const fileNames = ['file1.txt', 'file2.txt']; // Replace with your filenames
const downloadUrl = 'https://example.com/files'; // Replace with your download URL
await downloadFiles(fileNames, downloadUrl); |
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
-
I have a list of filenames i need to download from a website.
In nodejs how would i download these files in parallel using
ky
? is this even possible or should i usegot
?Beta Was this translation helpful? Give feedback.
All reactions