MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / Buffer

Function Buffer

lib/models/dav.js:1968–1983  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

1966 */
1967
1968function 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
1985Buffer.poolSize = 8192; // not used by this implementation
1986

Callers

nothing calls this directly

Calls 2

allocUnsafeFunction · 0.85
fromFunction · 0.85

Tested by

no test coverage detected