Skip to content

Commit 080ea27

Browse files
Copilotdanielroe
andcommitted
docs: add downloadToResponse to README
Co-authored-by: danielroe <[email protected]>
1 parent 849f22f commit 080ea27

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,14 @@ await downloadToFile({
7070
### Web APIs
7171

7272
```typescript
73-
import { downloadToBlob, parseUrl } from 'stackblitz-zip'
73+
import { downloadToBlob, downloadToResponse, parseUrl } from 'stackblitz-zip'
7474

75-
// download as Blob (browser-friendly)
75+
// download as Web Response (edge runtimes, servers)
7676
const projectId = parseUrl('https://stackblitz.com/edit/nuxt-starter-k7spa3r4')
77+
const response = await downloadToResponse({ projectId })
78+
// response can be returned directly from edge functions
79+
80+
// or download as Blob (browser-friendly)
7781
const blob = await downloadToBlob({ projectId })
7882

7983
// trigger browser download
@@ -136,6 +140,14 @@ Downloads a StackBlitz project and returns the path to the created zip file.
136140
- `maxTotalSize` (number, optional): Maximum total project size in bytes. Defaults to `104857600` (100MB)
137141
- `verbose` (boolean, optional): Enable console logging. Defaults to `false`
138142

143+
### `downloadToResponse(options): Promise<Response>`
144+
145+
Downloads a StackBlitz project and returns it as a Web Response (universal).
146+
147+
**Options:** Same as `downloadToFile` except `outputPath`
148+
149+
**Returns:** A Response object containing the zip file stream
150+
139151
### `downloadToBuffer(options): Promise<ArrayBuffer>`
140152

141153
Downloads a StackBlitz project and returns it as an ArrayBuffer (universal).

0 commit comments

Comments
 (0)