diff --git a/imageknife/src/main/ets/components/cache/FileUtils.ets b/imageknife/src/main/ets/components/cache/FileUtils.ets index 4a6af85..18ffe3c 100644 --- a/imageknife/src/main/ets/components/cache/FileUtils.ets +++ b/imageknife/src/main/ets/components/cache/FileUtils.ets @@ -111,18 +111,10 @@ export class FileUtils { */ writeData(path: string, content: ArrayBuffer | string) { try { - console.info("FileUtils - writeData size 1= " + path) let fd = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE).fd - console.info("FileUtils - writeData size 2= ") let stat = fs.statSync(path) - console.info("FileUtils - writeData size = " + stat.size) + console.info("FileUtils - writeData size = " + stat.size +" path="+path); fs.writeSync(fd, content, { offset: stat.size }) - let length = 0 - if (content instanceof ArrayBuffer) { - length = content.byteLength - } else { - length = content.length - } fs.closeSync(fd) } catch (e) { console.log("FileUtils - Failed to writeData for " + e) @@ -172,13 +164,11 @@ export class FileUtils { readFilePic(path: string): ArrayBuffer { try { let stat = fs.statSync(path) - console.info("FileUtils - readFilePic 1") let fd = fs.openSync(path, fs.OpenMode.READ_WRITE).fd; - let length = fs.statSync(path).size - console.info("FileUtils - readFilePic 2 length = " + length) + let length = stat.size let buf = new ArrayBuffer(length); - console.info("FileUtils - readFilePic 3") fs.readSync(fd, buf) + fs.closeSync(fd) return buf } catch (e) { console.log("FileUtils - readFilePic " + e)