#鸿蒙通关秘籍#什么是公共目录文件扫描?如何在next如如何扫描一个文件?

HarmonyOS
2024-12-09 10:58:12
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
MVT流光溢彩
function startFileScanTaskUnderSpecifiedDir() {
    let `guard`: fileGuard.FileGuard = new fileGuard.FileGuard();
    let `path`: string = '/data/test';
    let `onReceiveFileList`: (files: string[]) => void = (files: Array<string>) => {
        files.forEach((`value`: string, index: number) => {
            console.info(`Succeeded in getting file: ${`value`}.`);
        })
    };
    let `onCompleteScanTask`: (count: number) => void = (`count`: number) => {
        console.info(`Succeeded in getting count: ${`count`}.`);
    };
    let `scanFileCallback`: fileGuard.ScanFileCallback = {
        onReceiveFileList: `onReceiveFileList`,
        onTaskCompleted: `onCompleteScanTask`
    };
    guard.startFileScanTask(`path`, `scanFileCallback`);
}
分享
微博
QQ
微信
回复
2024-12-09 13:03:53
相关问题
公共样式提取到一个公共文件
450浏览 • 1回复 待解决
HarmonyOS 如何文件存储到公共目录
176浏览 • 1回复 待解决