• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Sharing an Application File
2
3An application can share a file with another application based on the uniform resource identifier (URI) of the file.
4
5## Using startAbility to Start a File Application
6
7[startAbility](../application-models/file-processing-apps-startup.md)-based file sharing: You can use [wantConstant.Flags](../reference/apis-ability-kit/js-apis-app-ability-wantConstant.md#flags) to specify the read or read/write permission on the file for the target application (application with which the file is shared). The target application can call [fs.open](../reference/apis-core-file-kit/js-apis-file-fs.md#fsopen) to open the file based on the URI and perform read and write operations.
8
9## Shareable Application Directories
10
11| Application Sandbox Path                            | Description             |
12| -------                              |  ---- |
13| /data/storage/el1/base               |  Encrypted database directory under **/el1**.|
14| /data/storage/el2/base               |  Encrypted database directory under **/el2**.|
15| /data/storage/el2/distributedfiles   |  Distributed data directory with an account under **el2/**.|
16
17## File URI Specifications
18
19The file URIs are in the following format:
20
21  file://<bundleName>/<path>
22
23- **file**: indicates a file URI.
24
25- *bundleName*: specifies the owner of the file, that is, the application that shares the file.
26
27- *path*: specifies the application sandbox path of the file.
28
29> **NOTE**
30>
31> - URI processing involves encoding and decoding. The system cannot guarantee the availability of the URI address that an application combines by itself.
32> - You are advised to use the APIs provided by the system to obtain URIs, for example, [getUriFromPath](../reference/apis-core-file-kit/js-apis-file-fileuri.md#fileurigeturifrompath).
33
34