可以参考该demo实现,大小不会变化getContext(this).resourceManager.getRawFileContent('test.tkm', (_err, value) => { let myBuffer: ArrayBufferLike = value.buffer let context = getContext(this); //沙箱路径 let filePath = context.filesDir + "/test.tkm"; let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let writeLen = fs.writeSync(file.fd, myBuffer); fs.closeSync(file); });
可以参考该demo实现,大小不会变化