tencent cloud

Tencent Cloud Super App as a Service

DocumentaçãoTencent Cloud Super App as a Service

Mini Program File Management

Baixar
Modo Foco
Tamanho da Fonte
Última atualização: 2026-01-29 00:28:08
Traduzido por IA
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);


Ajuda e Suporte

Esta página foi útil?

comentários