tencent cloud

Feedback

Mini Program File Management

Last updated: 2024-03-08 14:19:15

    Creating a file in the temporary directory of the mini program.

    The SDK facilitates the creation of files natively within the cache directory of the Mini Program, subsequently returning the local path of the file for the host's use.
    Sample code:
    TMAFileManager *fm = [[TMFMiniAppSDKManager sharedInstance] getFileManagerWithAppID:appInfo.appId];
    NSString *tmpPath = [fm createMediaTmpPathWithFileName:@"a.pdf" type:TMATmpPathTypeFile needTimestamp:YES];
    

    Converting an absolute path into a wxfile path.

    The SDK enables the conversion of file paths, originally created in the Mini Program's cache directory, into file paths used by the Mini Program itself, thereby facilitating internal use within the Mini Program.
    Sample code:
    TMAFileManager *fm = [[TMFMiniAppSDKManager sharedInstance] getFileManagerWithAppID:appInfo.appId];
    NSString *tmpPath = [fm createMediaTmpPathWithFileName:@"a.pdf" type:TMATmpPathTypeFile needTimestamp:YES];
    NSString *wxPath = [fm translateAnyPathToWxfilePath:tmpPath];

    Converting a wxfile path into an absolute path.

    The SDK enables the conversion of file paths, originally created in the Mini Program's cache directory, into file paths used by the Mini Program itself, thereby facilitating internal use within the Mini Program.
    Sample code:
    TMAFileManager *fm = [[TMFMiniAppSDKManager sharedInstance] getFileManagerWithAppID:appInfo.appId];
    
    NSString *filePath = [fm translateWxfilePathToAbsolutePath:wxPath];
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support