Urara-Blog/node_modules/.pnpm-store/v3/files/48/780106920386c3d4629bb708b202bc9d2e137f75eea3212cbcd63caa318418362643b4961398897500ba238a3d3cd38590a024dd5fd627bc4cea688f0ee8a1
2022-08-14 01:14:53 +08:00

10 lines
364 B
Text

var MIN_SIZE = 16 * 1024;
var SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported
module.exports = function adoptBuffer(buffer, size) {
if (buffer === null || buffer.length < size) {
return new SafeUint32Array(Math.max(size + 1024, MIN_SIZE));
}
return buffer;
};