Skip to content

Commit ed12ac2

Browse files
authored
Merge pull request #106 from script-development/engineer/http-docs-drift
docs: fix fs-http File Operations drift + index TS version claim
2 parents d68d22f + 1248925 commit ed12ac2

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ features:
2727
- title: Component Agnostic
2828
details: Toast and dialog services manage lifecycle and state — you bring your own Vue components. No opinionated UI. Your design system, our plumbing.
2929
- title: Type Safe
30-
details: Built with TypeScript 5.9+ in strict mode. Router navigation is type-checked against your route definitions. Translation keys are validated at compile time. No stringly-typed APIs.
30+
details: Built with TypeScript 6.0+ in strict mode. Router navigation is type-checked against your route definitions. Translation keys are validated at compile time. No stringly-typed APIs.
3131
---
3232

3333
## The Packages

docs/packages/http.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,21 +174,30 @@ Other packages hook into these middleware points. `fs-loading` registers request
174174

175175
## File Operations
176176

177+
`downloadRequest` and `previewRequest` are **transport-only** — they GET an endpoint as a `Blob` and return the full `AxiosResponse<Blob>`. Neither touches the DOM. There is no browser save dialog and no object-URL management inside fs-http; the consumer owns that orchestration (fs-packages issue #59). The two names share identical transport (`responseType: 'blob'`); the separate name communicates intent (download = save-to-disk, preview = inline-display).
178+
177179
### Download
178180

179-
Downloads a file and triggers a browser save dialog:
181+
GET a file as a `Blob`, then hand the blob to a download utility such as [`triggerDownload`](/packages/helpers) from `@script-development/fs-helpers`:
180182

181183
```typescript
182-
await http.downloadRequest('/reports/annual', 'annual-report', 'application/pdf');
184+
import {triggerDownload} from '@script-development/fs-helpers';
185+
186+
const response = await http.downloadRequest('/reports/annual');
187+
triggerDownload(response.data, 'annual-report.pdf');
183188
```
184189

190+
The response is the full `AxiosResponse<Blob>`, so headers (e.g. `content-type`) are available before the hand-off if you need to derive a filename or extension.
191+
185192
### Preview
186193

187-
Creates a blob URL for inline preview (images, PDFs):
194+
GET a file as a `Blob` for inline display (images, PDFs). The consumer manages the object-URL lifecycle:
188195

189196
```typescript
190-
const blobUrl = await http.previewRequest('/documents/123/preview');
191-
// Use in an <img> or <iframe> src
197+
const response = await http.previewRequest('/documents/123/preview');
198+
const blobUrl = URL.createObjectURL(response.data);
199+
// Use blobUrl in an <img> or <iframe> src; revoke when done:
200+
// URL.revokeObjectURL(blobUrl);
192201
```
193202

194203
::: warning `streamRequest` removed in 0.4.0

0 commit comments

Comments
 (0)