async read(path:string,unitBytes:number,progressCallback?:(bytesRead:number)=>void){
const file = fs.openSync(path);
const bufferArray:ArrayBuffer[]=[];
let totalBytesRead:number=0;
while(true){
const tmpBuffer = new ArrayBuffer(unitBytes);
const bytesRead = await fs.read(file.fd,tmpBuffer,{
length:unitBytes,
offset:totalBytesRead
});
if(bytesRead>0){
bufferArray.push(tmpBuffer);
totalBytesRead+=bytesRead;
if(progressCallback)progressCallback(totalBytesRead);
}else{
break;
}
}
return bufferArray;
}