Skip to content

Commit

Permalink
Change toBuffer implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
styfle committed Sep 3, 2018
1 parent 26bce8c commit a6f08c9
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/converter.ts
Expand Up @@ -18,10 +18,5 @@ export function toTypedArray(ab: ArrayBuffer) {
}

export function toBuffer(ab: ArrayBuffer) {
let buffer = Buffer.alloc(ab.byteLength);
let arr = new Uint8Array(ab); // TODO: can we just return Uint8Array?
for (let i = 0; i < arr.byteLength; i++) {
buffer[i] = arr[i];
}
return buffer;
return Buffer.from(ab);
}

0 comments on commit a6f08c9

Please sign in to comment.