* 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)
| 387 | */ |
| 388 | |
| 389 | function Buffer (arg, encodingOrOffset, length) { |
| 390 | if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { |
| 391 | return new Buffer(arg, encodingOrOffset, length) |
| 392 | } |
| 393 | |
| 394 | // Common case. |
| 395 | if (typeof arg === 'number') { |
| 396 | if (typeof encodingOrOffset === 'string') { |
| 397 | throw new Error( |
| 398 | 'If encoding is specified then the first argument must be a string' |
| 399 | ) |
| 400 | } |
| 401 | return allocUnsafe(this, arg) |
| 402 | } |
| 403 | return from(this, arg, encodingOrOffset, length) |
| 404 | } |
| 405 | |
| 406 | Buffer.poolSize = 8192 // not used by this implementation |
| 407 |
nothing calls this directly
no test coverage detected