diff --git a/docs/api/cozy-client/interfaces/models.file.FileUploadOptions.md b/docs/api/cozy-client/interfaces/models.file.FileUploadOptions.md
index 41adfd3631..1f4eedaf66 100644
--- a/docs/api/cozy-client/interfaces/models.file.FileUploadOptions.md
+++ b/docs/api/cozy-client/interfaces/models.file.FileUploadOptions.md
@@ -14,7 +14,7 @@ Conflict options
*Defined in*
-[packages/cozy-client/src/models/file.js:494](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L494)
+[packages/cozy-client/src/models/file.js:496](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L496)
***
@@ -26,7 +26,7 @@ Erase / rename
*Defined in*
-[packages/cozy-client/src/models/file.js:493](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L493)
+[packages/cozy-client/src/models/file.js:495](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L495)
***
@@ -38,7 +38,7 @@ The file Content-Type
*Defined in*
-[packages/cozy-client/src/models/file.js:492](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L492)
+[packages/cozy-client/src/models/file.js:494](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L494)
***
@@ -50,7 +50,7 @@ The dirId to upload the file to
*Defined in*
-[packages/cozy-client/src/models/file.js:490](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L490)
+[packages/cozy-client/src/models/file.js:492](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L492)
***
@@ -62,7 +62,7 @@ An object containing the metadata to attach
*Defined in*
-[packages/cozy-client/src/models/file.js:491](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L491)
+[packages/cozy-client/src/models/file.js:493](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L493)
***
@@ -74,4 +74,4 @@ The file name to upload
*Defined in*
-[packages/cozy-client/src/models/file.js:489](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L489)
+[packages/cozy-client/src/models/file.js:491](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L491)
diff --git a/docs/api/cozy-client/modules/models.file.md b/docs/api/cozy-client/modules/models.file.md
index efdb749cf2..9b90abfc7f 100644
--- a/docs/api/cozy-client/modules/models.file.md
+++ b/docs/api/cozy-client/modules/models.file.md
@@ -16,7 +16,7 @@
*Defined in*
-[packages/cozy-client/src/models/file.js:14](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L14)
+[packages/cozy-client/src/models/file.js:16](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L16)
## Functions
@@ -44,7 +44,7 @@ Copies a file to a specified destination.
*Defined in*
-[packages/cozy-client/src/models/file.js:662](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L662)
+[packages/cozy-client/src/models/file.js:664](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L664)
***
@@ -68,7 +68,38 @@ Upload a file on a mobile
*Defined in*
-[packages/cozy-client/src/models/file.js:599](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L599)
+[packages/cozy-client/src/models/file.js:601](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L601)
+
+***
+
+### downloadFile
+
+▸ **downloadFile**(`params`): `Promise`<`any`>
+
+Download the requested file
+
+This method can be used in a web page context or in a WebView hosted by a Flagship app
+
+When used in a FlagshipApp WebView context, then the action is redirected to the host app
+that will process the download
+
+*Parameters*
+
+| Name | Type | Description |
+| :------ | :------ | :------ |
+| `params` | `Object` | The download parameters |
+| `params.client` | [`CozyClient`](../classes/CozyClient.md) | Instance of CozyClient |
+| `params.file` | `IOCozyFile` | io.cozy.files metadata of the document to downloaded |
+| `params.url` | `string` | - |
+| `params.webviewIntent` | `WebviewService` | - |
+
+*Returns*
+
+`Promise`<`any`>
+
+*Defined in*
+
+[packages/cozy-client/src/models/file.js:718](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L718)
***
@@ -93,7 +124,7 @@ file object with path attribute
*Defined in*
-[packages/cozy-client/src/models/file.js:136](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L136)
+[packages/cozy-client/src/models/file.js:138](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L138)
***
@@ -114,7 +145,7 @@ file object with path attribute
*Defined in*
-[packages/cozy-client/src/models/file.js:645](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L645)
+[packages/cozy-client/src/models/file.js:647](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L647)
***
@@ -139,7 +170,7 @@ The files found by the rules
*Defined in*
-[packages/cozy-client/src/models/file.js:256](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L256)
+[packages/cozy-client/src/models/file.js:258](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L258)
***
@@ -163,7 +194,7 @@ Generate a file name for a revision
*Defined in*
-[packages/cozy-client/src/models/file.js:479](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L479)
+[packages/cozy-client/src/models/file.js:481](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L481)
***
@@ -188,7 +219,7 @@ A filename with the right suffix
*Defined in*
-[packages/cozy-client/src/models/file.js:449](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L449)
+[packages/cozy-client/src/models/file.js:451](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L451)
***
@@ -214,7 +245,7 @@ The full path of the file in the cozy
*Defined in*
-[packages/cozy-client/src/models/file.js:291](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L291)
+[packages/cozy-client/src/models/file.js:293](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L293)
***
@@ -238,7 +269,7 @@ id of the parent folder, if any
*Defined in*
-[packages/cozy-client/src/models/file.js:150](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L150)
+[packages/cozy-client/src/models/file.js:152](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L152)
***
@@ -262,7 +293,7 @@ A description of the status
*Defined in*
-[packages/cozy-client/src/models/file.js:162](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L162)
+[packages/cozy-client/src/models/file.js:164](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L164)
***
@@ -286,7 +317,7 @@ A doctype
*Defined in*
-[packages/cozy-client/src/models/file.js:182](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L182)
+[packages/cozy-client/src/models/file.js:184](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L184)
***
@@ -310,7 +341,7 @@ The mime-type of the target file, or an empty string is the target is not a file
*Defined in*
-[packages/cozy-client/src/models/file.js:172](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L172)
+[packages/cozy-client/src/models/file.js:174](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L174)
***
@@ -330,7 +361,7 @@ The mime-type of the target file, or an empty string is the target is not a file
*Defined in*
-[packages/cozy-client/src/models/file.js:625](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L625)
+[packages/cozy-client/src/models/file.js:627](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L627)
***
@@ -354,7 +385,7 @@ Whether the file's metadata attribute exists
*Defined in*
-[packages/cozy-client/src/models/file.js:280](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L280)
+[packages/cozy-client/src/models/file.js:282](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L282)
***
@@ -374,7 +405,7 @@ Whether the file's metadata attribute exists
*Defined in*
-[packages/cozy-client/src/models/file.js:617](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L617)
+[packages/cozy-client/src/models/file.js:619](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L619)
***
@@ -394,7 +425,7 @@ Whether the file's metadata attribute exists
*Defined in*
-[packages/cozy-client/src/models/file.js:46](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L46)
+[packages/cozy-client/src/models/file.js:48](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L48)
***
@@ -416,7 +447,7 @@ Whether the file is client-side encrypted
*Defined in*
-[packages/cozy-client/src/models/file.js:74](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L74)
+[packages/cozy-client/src/models/file.js:76](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L76)
***
@@ -436,7 +467,7 @@ Whether the file is client-side encrypted
*Defined in*
-[packages/cozy-client/src/models/file.js:40](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L40)
+[packages/cozy-client/src/models/file.js:42](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L42)
***
@@ -456,7 +487,7 @@ Whether the file is client-side encrypted
*Defined in*
-[packages/cozy-client/src/models/file.js:636](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L636)
+[packages/cozy-client/src/models/file.js:638](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L638)
***
@@ -478,7 +509,7 @@ Is file param a correct note
*Defined in*
-[packages/cozy-client/src/models/file.js:54](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L54)
+[packages/cozy-client/src/models/file.js:56](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L56)
***
@@ -500,7 +531,7 @@ Whether the file is supported by Only Office
*Defined in*
-[packages/cozy-client/src/models/file.js:84](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L84)
+[packages/cozy-client/src/models/file.js:86](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L86)
***
@@ -521,7 +552,7 @@ Whether the file is supported by Only Office
*Defined in*
-[packages/cozy-client/src/models/file.js:609](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L609)
+[packages/cozy-client/src/models/file.js:611](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L611)
***
@@ -545,7 +576,7 @@ Returns whether the file is a shortcut to a sharing
*Defined in*
-[packages/cozy-client/src/models/file.js:202](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L202)
+[packages/cozy-client/src/models/file.js:204](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L204)
***
@@ -569,7 +600,7 @@ Returns whether the sharing shortcut is new
*Defined in*
-[packages/cozy-client/src/models/file.js:227](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L227)
+[packages/cozy-client/src/models/file.js:229](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L229)
***
@@ -591,7 +622,7 @@ Returns whether the file is a shortcut to a sharing
*Defined in*
-[packages/cozy-client/src/models/file.js:192](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L192)
+[packages/cozy-client/src/models/file.js:194](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L194)
***
@@ -613,7 +644,7 @@ Returns whether the sharing shortcut is new
*Defined in*
-[packages/cozy-client/src/models/file.js:216](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L216)
+[packages/cozy-client/src/models/file.js:218](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L218)
***
@@ -635,7 +666,7 @@ true if the file is a shortcut
*Defined in*
-[packages/cozy-client/src/models/file.js:109](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L109)
+[packages/cozy-client/src/models/file.js:111](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L111)
***
@@ -670,7 +701,7 @@ Manage 4 cases :
*Defined in*
-[packages/cozy-client/src/models/file.js:320](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L320)
+[packages/cozy-client/src/models/file.js:322](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L322)
***
@@ -696,7 +727,7 @@ full normalized object
*Defined in*
-[packages/cozy-client/src/models/file.js:122](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L122)
+[packages/cozy-client/src/models/file.js:124](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L124)
***
@@ -723,7 +754,7 @@ The overrided file
*Defined in*
-[packages/cozy-client/src/models/file.js:415](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L415)
+[packages/cozy-client/src/models/file.js:417](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L417)
***
@@ -745,7 +776,7 @@ Read a file on a mobile
*Defined in*
-[packages/cozy-client/src/models/file.js:552](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L552)
+[packages/cozy-client/src/models/file.js:554](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L554)
***
@@ -771,7 +802,7 @@ The saved file
*Defined in*
-[packages/cozy-client/src/models/file.js:242](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L242)
+[packages/cozy-client/src/models/file.js:244](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L244)
***
@@ -795,7 +826,7 @@ But we want to exclude .txt and .md because the CozyUI Viewer can already show t
*Defined in*
-[packages/cozy-client/src/models/file.js:99](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L99)
+[packages/cozy-client/src/models/file.js:101](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L101)
***
@@ -822,7 +853,7 @@ Returns base filename and extension
*Defined in*
-[packages/cozy-client/src/models/file.js:24](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L24)
+[packages/cozy-client/src/models/file.js:26](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L26)
***
@@ -855,4 +886,4 @@ If there is a conflict, then we apply the conflict strategy : `erase` or `rename
*Defined in*
-[packages/cozy-client/src/models/file.js:512](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L512)
+[packages/cozy-client/src/models/file.js:514](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/file.js#L514)
diff --git a/docs/api/cozy-stack-client.md b/docs/api/cozy-stack-client.md
index 23db3115c9..4d684b1db7 100644
--- a/docs/api/cozy-stack-client.md
+++ b/docs/api/cozy-stack-client.md
@@ -2570,6 +2570,7 @@ Document representing a io.cozy.files
| Name | Type | Description |
| --- | --- | --- |
| _id | string
| Id of the file |
+| _rev | string
| Rev of the file |
| attributes | [FileAttributes
](#FileAttributes) | Attributes of the file |
| meta | object
| Meta |
| relationships | object
| Relationships |
diff --git a/packages/cozy-client/types/models/file.d.ts b/packages/cozy-client/types/models/file.d.ts
index f4bfb55e15..4cb039ad4c 100644
--- a/packages/cozy-client/types/models/file.d.ts
+++ b/packages/cozy-client/types/models/file.d.ts
@@ -68,6 +68,12 @@ export function hasCertifications(file: import("../types").IOCozyFile): boolean;
export function isFromKonnector(file: import("../types").IOCozyFile): boolean;
export function fetchBlobFileById(client: CozyClient, fileId: string): Promise;
export function copy(client: object, file: object, destination: object): Promise;
+export function downloadFile({ client, file, url, webviewIntent }: {
+ client: CozyClient;
+ file: import("../types").IOCozyFile;
+ url: string;
+ webviewIntent: import('cozy-intent').WebviewService;
+}): Promise;
export type FileUploadOptions = {
/**
* - The file name to upload
diff --git a/packages/cozy-client/types/types.d.ts b/packages/cozy-client/types/types.d.ts
index 47ab433ff4..a9a9c792c0 100644
--- a/packages/cozy-client/types/types.d.ts
+++ b/packages/cozy-client/types/types.d.ts
@@ -820,6 +820,10 @@ export type FileDocument = {
* - Id of the file
*/
_id: string;
+ /**
+ * - Rev of the file
+ */
+ _rev: string;
/**
* - Doctype of the file
*/