Skip to content

Commit 25ca30f

Browse files
authored
docs: discourage Download.createReadStream (#37831)
1 parent e6e6525 commit 25ca30f

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

docs/src/api/class-download.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ Upon successful cancellations, `download.failure()` would resolve to `'canceled'
7474

7575
Returns a readable stream for a successful download, or throws for a failed/canceled download.
7676

77+
:::note
78+
If you don't need a readable stream, it's usually simpler to read the file from disk after the download completed. See [`method: Download.path`].
79+
:::
80+
7781
## async method: Download.delete
7882
* since: v1.8
7983

packages/playwright-client/types/types.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19106,6 +19106,10 @@ export interface Download {
1910619106

1910719107
/**
1910819108
* Returns a readable stream for a successful download, or throws for a failed/canceled download.
19109+
*
19110+
* **NOTE** If you don't need a readable stream, it's usually simpler to read the file from disk after the download
19111+
* completed. See [download.path()](https://playwright.dev/docs/api/class-download#download-path).
19112+
*
1910919113
*/
1911019114
createReadStream(): Promise<Readable>;
1911119115

packages/playwright-core/types/types.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19106,6 +19106,10 @@ export interface Download {
1910619106

1910719107
/**
1910819108
* Returns a readable stream for a successful download, or throws for a failed/canceled download.
19109+
*
19110+
* **NOTE** If you don't need a readable stream, it's usually simpler to read the file from disk after the download
19111+
* completed. See [download.path()](https://playwright.dev/docs/api/class-download#download-path).
19112+
*
1910919113
*/
1911019114
createReadStream(): Promise<Readable>;
1911119115

0 commit comments

Comments
 (0)