Skip to content

Commit 0baa2df

Browse files
committed
docs updated
1 parent e575fa9 commit 0baa2df

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

docs/content/en/api/query-builder-methods.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,21 @@ await Model.$find(1)
316316

317317
<alert type="info">These `$`-prefixed convenience methods always return the requested content.
318318
They handle and unwrap responses within "data".</alert>
319+
320+
## `file`
321+
- Returns: `Binary`
322+
323+
Execute the query with $http.responseType as `blob` and returns a binary
324+
325+
```js
326+
// get the blob
327+
const data = await Model.file()
328+
329+
// force file download
330+
const url = window.URL.createObjectURL(new Blob([data]));
331+
const link = document.createElement('a');
332+
link.href = url;
333+
link.setAttribute('download', 'model.xlsx'); //or any other extension
334+
document.body.appendChild(link);
335+
link.click();
336+
```

index.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,13 @@ export class Model extends StaticModel {
675675
*/
676676
get (): QueryPromise<this[]>
677677

678-
file (): QueryPromise<void>
678+
/**
679+
* Execute the query and get all results.
680+
*
681+
* @see {@link https://robsontenorio.github.io/vue-api-query/api/query-builder-methods#file|API Reference}
682+
* @see {@link https://robsontenorio.github.io/vue-api-query/building-the-query#retrieving-a-list-of-records|Building the Query}
683+
*/
684+
file (): QueryPromise<BlobPart[]>
679685

680686
/**
681687
* Execute the query and get all results.

0 commit comments

Comments
 (0)