* 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
(arg, encodingOrOffset, length)
| 215 | */ |
| 216 | |
| 217 | function Buffer (arg, encodingOrOffset, length) { |
| 218 | // Common case. |
| 219 | if (typeof arg === 'number') { |
| 220 | if (typeof encodingOrOffset === 'string') { |
| 221 | throw new Error( |
| 222 | 'If encoding is specified then the first argument must be a string' |
| 223 | ) |
| 224 | } |
| 225 | return allocUnsafe(arg) |
| 226 | } |
| 227 | return from(arg, encodingOrOffset, length) |
| 228 | } |
| 229 | |
| 230 | // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 |
| 231 | if (typeof Symbol !== 'undefined' && Symbol.species && |
no test coverage detected
searching dependent graphs…