中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
微信扫码分享
import { BusinessError } from '@kit.BasicServicesKit'; function openFilePromise() { let `guard`: fileGuard.FileGuard = new fileGuard.FileGuard(); let `path`: string = '/data/test'; guard.openFile(`path`).then((fd: number) => { console.info(`Succeeded in opening file. path: ${`path`} , fd: ${fd}.`); }).catch((err: BusinessError) => { console.error(`Failed to open file. Code: ${err.code}, message: ${err.message}.`); }); }