* The Buffer constructor returns instances of `Uint8Array` that have their * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of * `Uint8Array`, so the returned instances will have all the node `Buffer` methods * and the `Uint8Array` methods. Square bracket notation wo
(arg, encodingOrOffset, length)
| 9787 | */ |
| 9788 | |
| 9789 | function Buffer (arg, encodingOrOffset, length) { |
| 9790 | if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { |
| 9791 | return new Buffer(arg, encodingOrOffset, length) |
| 9792 | } |
| 9793 | |
| 9794 | // Common case. |
| 9795 | if (typeof arg === 'number') { |
| 9796 | if (typeof encodingOrOffset === 'string') { |
| 9797 | throw new Error( |
| 9798 | 'If encoding is specified then the first argument must be a string' |
| 9799 | ) |
| 9800 | } |
| 9801 | return allocUnsafe(this, arg) |
| 9802 | } |
| 9803 | return from(this, arg, encodingOrOffset, length) |
| 9804 | } |
| 9805 | |
| 9806 | Buffer.poolSize = 8192 // not used by this implementation |
| 9807 |
nothing calls this directly
no test coverage detected