my.getFileInfo

Get file information.

Supported types of mini programs: DSL, H5+

Sample Code

copy
my.getFileInfo({
    apFilePath: 'https://resource/apml953bb093ebd2834530196f50a4413a87.video',
    digestAlgorithm: 'sha1',
    success: (res)=> {
        console.log(JSON.stringify(res))
    }
})

Parameters

PropertyType

Required

Description
apFilePathStringYesFile path.
digestAlgorithmStringNoDigest algorithm, supporting md5 and sha1, md5 by default.
successFunctionNoCallback function upon call success.
failFunctionNoCallback function upon call failure.
completeFunctionNoCallback function upon call completion (to be executed upon either call success or failure).

Success Callback Function

The incoming parameter is of the Object type with the following attributes:

PropertyTypeDescription
sizeNumberFile size.
digestStringDigest result.

Error code

Error Code

Error message

Further action

2

Invalid parameters

Ensure that the apFilePath parameter is specified correctly

12

file does not exist

Ensure that the apFilePath parameter is specified correctly and the target file exists.

16

The digestalgorithm parameter only supports MD5 and SHA1

Ensure that the digestAlgorithm parameter only supports md5and sha1.

17

Calculation file summary information error

File summary/digest calculation failed. Please try again.