未验证 提交 a0ba2bc2 编写于 作者: O openharmony_ci 提交者: Gitee

!21006 关于fs调用相关的示例代码修改

Merge pull request !21006 from jiao_yanlin_001/master
......@@ -4862,10 +4862,10 @@ async function getCacheDir(){
}
let filePath = path + '/StarWars10s-2C-48000-4SW.wav';
let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
let currStat = await fs.stat(path);
let buf = new ArrayBuffer(bufferSize);
let len = currStat.size % bufferSize == 0 ? Math.floor(currStat.size / bufferSize) : Math.floor(currStat.size / bufferSize + 1);
for (let i = 0;i < len; i++) {
fs.stat(path).then((stat) => {
let buf = new ArrayBuffer(bufferSize);
let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1);
for (let i = 0;i < len; i++) {
let options = {
offset: i * bufferSize,
length: bufferSize
......@@ -4880,7 +4880,9 @@ for (let i = 0;i < len; i++) {
}
})
})
}
}
});
```
......@@ -4916,10 +4918,10 @@ async function getCacheDir(){
}
let filePath = path + '/StarWars10s-2C-48000-4SW.wav';
let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
let currStat = await fs.stat(path);
let buf = new ArrayBuffer(bufferSize);
let len = currStat.size % bufferSize == 0 ? Math.floor(currStat.size / bufferSize) : Math.floor(currStat.size / bufferSize + 1);
for (let i = 0;i < len; i++) {
fs.stat(path).then((stat) => {
let buf = new ArrayBuffer(bufferSize);
let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1);
for (let i = 0;i < len; i++) {
let options = {
offset: i * bufferSize,
length: bufferSize
......@@ -4930,7 +4932,8 @@ for (let i = 0;i < len; i++) {
} catch(err) {
console.error(`audioRenderer.write err: ${err}`);
}
}
}
});
```
### getAudioTime<sup>8+</sup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册