File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -316,3 +316,21 @@ await Model.$find(1)
316316
317317<alert type =" info " >These ` $ ` -prefixed convenience methods always return the requested content.
318318They 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+ ```
Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments