docs(download): improve documentation (#6486)

This commit is contained in:
Sébastien Règne 2021-05-11 22:27:50 +02:00 committed by GitHub
parent d08c50d277
commit 33823a9143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -2,8 +2,8 @@
[Download] objects are dispatched by page via the [`event: Page.download`] event. [Download] objects are dispatched by page via the [`event: Page.download`] event.
All the downloaded files belonging to the browser context are deleted when the browser context is closed. All downloaded If `downloadsPath` isn't specified, all the downloaded files belonging to the browser context are deleted when the
files are deleted when the browser closes. browser context is closed. And all downloaded files are deleted when the browser closes.
Download event is emitted once the download starts. Download path becomes available once download completes: Download event is emitted once the download starts. Download path becomes available once download completes:
@ -77,13 +77,13 @@ wait for the download to finish if necessary. The method throws when connected r
## async method: Download.saveAs ## async method: Download.saveAs
Saves the download to a user-specified path. It is safe to call this method while the download Copy the download to a user-specified path. It is safe to call this method while the download
is still in progress. is still in progress. Will wait for the download to finish if necessary.
### param: Download.saveAs.path ### param: Download.saveAs.path
- `path` <[path]> - `path` <[path]>
Path where the download should be saved. Path where the download should be copied.
## method: Download.suggestedFilename ## method: Download.suggestedFilename
- returns: <[string]> - returns: <[string]>

9
types/types.d.ts vendored
View File

@ -9264,8 +9264,8 @@ export interface Dialog {
* [Download] objects are dispatched by page via the * [Download] objects are dispatched by page via the
* [page.on('download')](https://playwright.dev/docs/api/class-page#pageondownload) event. * [page.on('download')](https://playwright.dev/docs/api/class-page#pageondownload) event.
* *
* All the downloaded files belonging to the browser context are deleted when the browser context is closed. All downloaded * If `downloadsPath` isn't specified, all the downloaded files belonging to the browser context are deleted when the
* files are deleted when the browser closes. * browser context is closed. And all downloaded files are deleted when the browser closes.
* *
* Download event is emitted once the download starts. Download path becomes available once download completes: * Download event is emitted once the download starts. Download path becomes available once download completes:
* *
@ -9305,8 +9305,9 @@ export interface Download {
path(): Promise<null|string>; path(): Promise<null|string>;
/** /**
* Saves the download to a user-specified path. It is safe to call this method while the download is still in progress. * Copy the download to a user-specified path. It is safe to call this method while the download is still in progress. Will
* @param path Path where the download should be saved. * wait for the download to finish if necessary.
* @param path Path where the download should be copied.
*/ */
saveAs(path: string): Promise<void>; saveAs(path: string): Promise<void>;