mirror of
https://gitee.com/openharmony/applications_app_samples
synced 2024-11-27 18:50:42 +00:00
add get buffer from uri
Signed-off-by: zhaojunxia <zhaojunxia@kaihong.com>
This commit is contained in:
parent
d44fd569c9
commit
a454836f13
@ -96,6 +96,21 @@ export default class FileFs {
|
||||
}
|
||||
}
|
||||
|
||||
getFileContentBuffer(path: string): ArrayBuffer {
|
||||
let buf = new ArrayBuffer(BUFFER_SIZE);
|
||||
try {
|
||||
logger.info(TAG, 'modifyFileToWatcher getFileContent filePath = ' + path);
|
||||
let file = fs.openSync(path, fs.OpenMode.READ_WRITE);
|
||||
let num = fs.readSync(file.fd, buf);
|
||||
logger.info(TAG, 'modifyFileToWatcher getFileContent read num = ' + num);
|
||||
fs.closeSync(file);
|
||||
return buf;
|
||||
} catch (e) {
|
||||
logger.error(TAG, `modifyFileToWatcher getFileContent has failed for: {message: ${e.message}, code: ${e.code}}`);
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
getFileContent(path: string): string {
|
||||
let resultPut = '';
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user