11/**
2- * Function to rename downloaded files.
2+ Function to rename downloaded files.
33 */
44export interface RenameFunction {
55 /**
@@ -11,52 +11,51 @@ export interface RenameFunction {
1111}
1212
1313/**
14- * Options for the multiDownload function.
14+ Options for the multiDownload function.
1515 */
1616export interface MultiDownloadOptions {
1717 /**
18- * The function to rename the downloaded files.
19- * @default undefined (use original filenames)
18+ The function to rename the downloaded files.
19+ @default undefined (use original filenames)
2020 */
2121 rename ?: RenameFunction ;
2222
2323 /**
24- * The delay time between each file download in milliseconds.
25- * @default 1000
24+ The delay time between each file download in milliseconds.
25+ @default 1000
2626 */
27- delayTime ?: number ;
27+ downloadInterval ?: number ;
2828}
2929
3030/**
31- * Download multiple files at once.
32- * @param urls The URLs to download.
33- * @param options The options for downloading.
34- * @param options.rename The function to rename the downloaded files.
35- * @param options.delayTime The delay time between each file download.
36- * @example
37- * ```typescript
38- * import { multiDownload } from 'multi-download';
39- *
40- * async function downloadFiles() {
41- * const urls = [
42- * 'https://example.com/file1.txt',
43- * 'https://example.com/file2.txt',
44- * 'https://example.com/file3.txt',
45- * ];
46- *
47- * try {
48- * await multiDownload(urls, {
49- * rename: ({ url, index }) => `file${index + 1}.txt`,
50- * delayTime: 1000,
51- * });
52- * console.log('Files downloaded successfully');
53- * } catch (error) {
54- * console.error('Error downloading files:', error);
55- * }
56- * }
57- *
58- * downloadFiles();
59- * ```
31+ Download multiple files from an array of URLs.
32+ @param urls - The URLs to download.
33+ @param options - The options for downloading.
34+ @returns A promise that resolves when all files have been downloaded.
35+ @example
36+ ```
37+ import { multiDownload } from 'multi-download';
38+
39+ async function downloadFiles() {
40+ const urls = [
41+ 'https://example.com/file1.txt',
42+ 'https://example.com/file2.txt',
43+ 'https://example.com/file3.txt',
44+ ];
45+
46+ try {
47+ await multiDownload(urls, {
48+ rename: ({ url, index }) => `file${index + 1}.txt`,
49+ downloadInterval: 1000,
50+ });
51+ console.log('Files downloaded successfully');
52+ } catch (error) {
53+ console.error('Error downloading files:', error);
54+ }
55+ }
56+
57+ downloadFiles();
58+ ```
6059 */
6160export default function multiDownload (
6261 urls : string [ ] ,
0 commit comments