docs: improve Download methods documentation (#5760)

This commit is contained in:
Yury Semikhatsky 2021-03-08 19:52:07 -08:00 committed by GitHub
parent 1a94ea5f6c
commit aae8cc839a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View file

@ -62,21 +62,23 @@ Returns readable stream for current download or `null` if download failed.
## async method: Download.delete
Deletes the downloaded file.
Deletes the downloaded file. Will wait for the download to finish if necessary.
## async method: Download.failure
- returns: <[null]|[string]>
Returns download error if any.
Returns download error if any. Will wait for the download to finish if necessary.
## async method: Download.path
- returns: <[null]|[path]>
Returns path to the downloaded file in case of successful download.
Returns path to the downloaded file in case of successful download. The method will
wait for the download to finish if necessary.
## async method: Download.saveAs
Saves the download to a user-specified path.
Saves the download to a user-specified path. It is safe to call this method while the download
is still in progress.
### param: Download.saveAs.path
- `path` <[path]>

9
types/types.d.ts vendored
View file

@ -9124,22 +9124,23 @@ export interface Download {
createReadStream(): Promise<null|Readable>;
/**
* Deletes the downloaded file.
* Deletes the downloaded file. Will wait for the download to finish if necessary.
*/
delete(): Promise<void>;
/**
* Returns download error if any.
* Returns download error if any. Will wait for the download to finish if necessary.
*/
failure(): Promise<null|string>;
/**
* Returns path to the downloaded file in case of successful download.
* Returns path to the downloaded file in case of successful download. The method will wait for the download to finish if
* necessary.
*/
path(): Promise<null|string>;
/**
* Saves the download to a user-specified path.
* Saves the download to a user-specified path. It is safe to call this method while the download is still in progress.
* @param path Path where the download should be saved.
*/
saveAs(path: string): Promise<void>;