| 78622 | } |
| 78623 | |
| 78624 | function fromArrayBuffer (that, array, byteOffset, length) { |
| 78625 | array.byteLength // this throws if `array` is not a valid ArrayBuffer |
| 78626 | |
| 78627 | if (byteOffset < 0 || array.byteLength < byteOffset) { |
| 78628 | throw new RangeError('\'offset\' is out of bounds') |
| 78629 | } |
| 78630 | |
| 78631 | if (array.byteLength < byteOffset + (length || 0)) { |
| 78632 | throw new RangeError('\'length\' is out of bounds') |
| 78633 | } |
| 78634 | |
| 78635 | if (byteOffset === undefined && length === undefined) { |
| 78636 | array = new Uint8Array(array) |
| 78637 | } else if (length === undefined) { |
| 78638 | array = new Uint8Array(array, byteOffset) |
| 78639 | } else { |
| 78640 | array = new Uint8Array(array, byteOffset, length) |
| 78641 | } |
| 78642 | |
| 78643 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 78644 | // Return an augmented `Uint8Array` instance, for best performance |
| 78645 | that = array |
| 78646 | that.__proto__ = Buffer.prototype |
| 78647 | } else { |
| 78648 | // Fallback: Return an object instance of the Buffer class |
| 78649 | that = fromArrayLike(that, array) |
| 78650 | } |
| 78651 | return that |
| 78652 | } |
| 78653 | |
| 78654 | function fromObject (that, obj) { |
| 78655 | if (Buffer.isBuffer(obj)) { |