Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

File.download

File.download([path, { overwrite, onProgress, signal }]) → Promise<string>

Downloads the file. If a file with the same contents already exists at the path, it is left as is. Only available in Node.js.

Parameters:

path : string, optional The path of the downloaded file, or a directory to download it into (if the directory exists, or the path ends with a /). Defaults to the current working directory.

overwrite : boolean, default false Whether to replace an existing file whose contents differ. Otherwise, a ValueError is thrown.

onProgress : function, optional Called with { bytesDownloaded, totalBytes } as the file is downloaded.

signal : AbortSignal, optional

Returns: Promise<string>, the path of the downloaded file.

Was this helpful?