thegecko/webusb

bufferSourceToBuffer would remove the byteOffset and length information

qazwsxedcrfvtg14 opened this issue · 0 comments

bufferSourceToBuffer in src/adapter.ts would remove the byteOffset and length information from data.

For example:

const buffer = new ArrayBuffer(16);
const array = new Uint8Array(buffer,4,8);
console.log(array.byteLength); // output: 8
console.log(array.buffer.byteLength); // output: 16

bufferSource.buffer would return the original buffer, and that is not the right data to transfer.
It should transfer the data with the correct offset and length.