let documentSelectOptions = new picker.DocumentSelectOptions();
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select(documentSelectOptions).then((documentSelectResult: Array<string>) => {
let filePath = documentSelectResult[0];
hash.hash(filePath, "sha256").then((str: string) => {
hilog.info(0x0000, 'testTag', "calculate file hash succeed:", str);
}).catch((err: BusinessError) => {
hilog.error(0x0000, 'testTag', "calculate file hash failed with error",
" message: " + err.message + ", error code: " + err.code);
});
}).catch((err: BusinessError) => {
console.error('DocumentViewPicker.select failed with err: ' + JSON.stringify(err));
});
报错为:13900002;根据文档描述使用该功能模块对文件/目录进行操作前,需要先获取其应用沙箱路径,但是documentSelectResult已经是绝对路径了,该如何处理?
hash接口只支持Path作为入参。