• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 应用文件服务
2
3## **简介**
4应用文件服务是为应用提供文件分享和管理能力的服务,包含应用间文件分享、跨设备同应用文件分享以及跨设备跨应用文件分享的能力。
5当前已具备基于分布式文件系统的跨设备同应用文件分享能力。
6
7## **目录**
8```
9/foundation/filemanagement/app_file_service
10│── interfaces                        // 接口声明
11│  ├── innerkits                      // 对内接口声明
12│  └── kits                           // 对外接口声明
13```
14
15## **说明**
16### 接口说明
17**表1** 应用文件服务接口说明
18| **接口名** | **说明** |
19| --- | --- |
20| createSharePath(fd: number, cid: string, callback: AsyncCallback\<string>): void <br> createSharePath(fd: number, cid: string): Promise\<string> | 将文件fd与设备cid传递给分布式文件系统,创建跨设备分享路径 |
21### 使用说明
22createSharePath接口为分享文件fd创建能够跨设备访问的分布式路径,异步返回创建结果,设备号cid用于指定分享设备。
23
24示例:
25```
26import remotefileshare from '@ohos.remotefileshare'
27
28remotefileshare.createSharePath(fd, cid, function(err, path) {
29    // callback
30});
31
32remotefileshare.createSharePath(fd, cid).then(function(path) {
33    // promise
34});
35```
36
37## **相关仓**
38
39- [Linux内核5.10](https://gitee.com/openharmony/kernel_linux_5.10)
40- [文件访问接口](https://gitee.com/zkx48/filemanagement_file_api)