* 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)
| 1966 | */ |
| 1967 | |
| 1968 | function Buffer (arg, encodingOrOffset, length) { |
| 1969 | if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { |
| 1970 | return new Buffer(arg, encodingOrOffset, length) |
| 1971 | } |
| 1972 | |
| 1973 | // Common case. |
| 1974 | if (typeof arg === 'number') { |
| 1975 | if (typeof encodingOrOffset === 'string') { |
| 1976 | throw new Error( |
| 1977 | 'If encoding is specified then the first argument must be a string' |
| 1978 | ) |
| 1979 | } |
| 1980 | return allocUnsafe(this, arg) |
| 1981 | } |
| 1982 | return from(this, arg, encodingOrOffset, length) |
| 1983 | } |
| 1984 | |
| 1985 | Buffer.poolSize = 8192; // not used by this implementation |
| 1986 |
nothing calls this directly
no test coverage detected