Chuyển tới nội dung chính

getSavedFileList

Bắt đầu hỗ trợ ở phiên bản:

  • SDK: 2.51.0
  • Android: 25.11.02
  • IOS: 25.12.02

Lấy thông tin tất cả các local data file đã được lưu của mini app.

Parameters

Object object

PropertyTypeDefaultRequiredDescriptionMinimum Version
successfunctionCallback function khi gọi api thành công
failfunctionCallback function khi gọi api thất bại

Return Values

Promise <Object data>

PropertyTypeDescriptionMinimum Version
listArray <FileInfo>Danh sách file đã lưu cục bộ

Entities

FileInfo

PropertyTypeDescriptionMinimum Version
filePathstringĐường dẫn tới file trong folder cục bộ của mini app.
sizenumberKích thước file (byte size)
createTimenumberThời gian file được tạo
typestringType của file (Vd: image/jpeg, video/mp4)

Sample Code

import { LFSStorage } from 'zmp-sdk/apis';

LFSStorage.getSavedFileList({
success: (data) => {
// xử lý khi gọi api thành công
const { list } = data;
},
fail: (error) => {
// xử lý khi gọi api thất bại
console.log(error);
},
});

// hoặc

import { LFSStorage } from 'zmp-sdk/apis';

const getSavedFileList = async () => {
try {
const { list } = await LFSStorage.getSavedFileList({});
} catch (error) {
// xử lý khi gọi api thất bại
console.log(error);
}
};
miniapp-logo

Khám phá