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

Function createBuffer

lib/models/dav.js:1939–1956  ·  view source on GitHub ↗
(that, length)

Source from the content-addressed store, hash-verified

1937}
1938
1939function createBuffer (that, length) {
1940 if (kMaxLength() < length) {
1941 throw new RangeError('Invalid typed array length')
1942 }
1943 if (Buffer.TYPED_ARRAY_SUPPORT) {
1944 // Return an augmented `Uint8Array` instance, for best performance
1945 that = new Uint8Array(length);
1946 that.__proto__ = Buffer.prototype;
1947 } else {
1948 // Fallback: Return an object instance of the Buffer class
1949 if (that === null) {
1950 that = new Buffer(length);
1951 }
1952 that.length = length;
1953 }
1954
1955 return that
1956}
1957
1958/**
1959 * The Buffer constructor returns instances of `Uint8Array` that have their

Callers 5

allocFunction · 0.85
allocUnsafeFunction · 0.85
fromStringFunction · 0.85
fromArrayLikeFunction · 0.85
fromObjectFunction · 0.85

Calls 1

kMaxLengthFunction · 0.85

Tested by

no test coverage detected