// @flow export const toBuffer = (arr: Buffer | Uint8Array | Array): Buffer => { if (arr instanceof Buffer) { return arr; } else if (arr instanceof Uint8Array) { return Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength); } else { return Buffer.from(arr); } };