tencent cloud

Tencent Cloud Super App as a Service

문서Tencent Cloud Super App as a Service

Mini Program File Management

포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-01-29 00:28:08
The mini program file management API allows for the conversion and creation of file paths between the mini program and the superapp local storage.
Note:
Mini program file path: A path starting with wxfile://, used by mini program developers. The mini program SDK maps these paths to local file paths within the superapp.
Superapp local file path: An absolute path in the superapp storage, e.g., /data/data/com.tencent.miniapp.demo/app_T1701421723ASSNID/2121/files/mini/.
All mini program files are managed by IMiniAppFileManager which can be obtained from the mini program context IMiniAppContext. IMiniAppContext can be accessed via  BaseJsPlugin.
IMiniAppFileManager fileManager = mMiniAppContext.getManager(IMiniAppFileManager.class)

CREATING FILES IN THE MINI PROGRAM TEMPORARY DIRECTORY

The SDK supports creating files in the mini program's cache directory and returns the local path for the superapp to use.
Sample code:
String tmpPath = fileManager.getTmpPath(".jpg");

Converting absolute paths to wxfile paths

The SDK can convert file paths created in the mini program's cache directory to paths usable by the mini program.
Sample code:
String wxfile = fileManager.getWxFilePath(path);

wxfile paths converted to absolute paths

The SDK supports converting wxfile paths in the cache directory to local paths.
Sample code:
String path = fileManager.getAbsolutePath(wxfile);


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백