File APIs

getFileInfo

Get file information including size and digest.

Overview

my.getFileInfo retrieves information about a file, including its size and an optional digest (hash) for verification.

Sample Code

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

Parameters

PropertyTypeRequiredDescription
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.

Usage Notes

  • Supports both md5 and sha1 digest algorithms
  • Default algorithm is md5 if not specified
  • The digest can be used for file integrity verification
  • Works with network URLs and local file paths