From 33823a91433ee3de1179a91d6763cfe41300c5a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20R=C3=A8gne?= Date: Tue, 11 May 2021 22:27:50 +0200 Subject: [PATCH] docs(download): improve documentation (#6486) --- docs/src/api/class-download.md | 10 +++++----- types/types.d.ts | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/src/api/class-download.md b/docs/src/api/class-download.md index b1e6fd8196..e5de7a7313 100644 --- a/docs/src/api/class-download.md +++ b/docs/src/api/class-download.md @@ -2,8 +2,8 @@ [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 -files are deleted when the browser closes. +If `downloadsPath` isn't specified, all the downloaded files belonging to the browser context are deleted when the +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: @@ -77,13 +77,13 @@ wait for the download to finish if necessary. The method throws when connected r ## async method: Download.saveAs -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 wait for the download to finish if necessary. ### param: Download.saveAs.path - `path` <[path]> -Path where the download should be saved. +Path where the download should be copied. ## method: Download.suggestedFilename - returns: <[string]> diff --git a/types/types.d.ts b/types/types.d.ts index c983bfdc61..d021a7975c 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -9264,8 +9264,8 @@ export interface Dialog { * [Download] objects are dispatched by page via the * [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 - * files are deleted when the browser closes. + * If `downloadsPath` isn't specified, all the downloaded files belonging to the browser context are deleted when the + * 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: * @@ -9305,8 +9305,9 @@ export interface Download { path(): Promise; /** - * 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. + * Copy the download to a user-specified path. It is safe to call this method while the download is still in progress. Will + * wait for the download to finish if necessary. + * @param path Path where the download should be copied. */ saveAs(path: string): Promise;