Skip to main content
Version: 3.x

Taro.getSavedFileList(option)

Gets the list of local cache files saved under the Mini Program.

Reference

Type

(option?: Option) => Promise<SuccessCallbackResult>

Parameters

Option

PropertyTypeRequiredDescription
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

SuccessCallbackResult

PropertyTypeDescription
fileListFileItem[]File array, with each item being a FileItem
errMsgstringCall result

FileItem

res.fileList is composed as follows

PropertyTypeDescription
createTimenumberThe timestamp when the file was saved, which is defined as the number of seconds that have elapsed since 1970/01/01 08:00:00 to the current time
filePathstringLocal path
sizenumberLocal file size in bytes

Sample Code

Taro.getSavedFileList({
success: function (res) {
console.log(res.fileList)
}
})

API Support

APIWeChat Mini-ProgramH5React Native
Taro.getSavedFileList✔️✔️