decord/source/4243_allocUnsafe.js

47 lines
911 B
JavaScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 4243
2026-07-27 11:26:19 +00:00
// Function ID: 37341
2026-07-20 16:05:17 +00:00
// Name: allocUnsafe
2026-07-23 10:11:24 +00:00
// Dependencies: [580]
2026-07-20 16:05:17 +00:00
2026-07-25 08:10:48 +00:00
// Module 4243 (allocUnsafe)
2026-07-23 10:11:24 +00:00
const tmp = "object" === typeof exports && exports && !exports.nodeType && exports;
2026-07-20 16:05:17 +00:00
let tmp2 = tmp;
2026-07-23 10:11:24 +00:00
if (tmp) {
2026-07-20 16:05:17 +00:00
tmp2 = "object" === typeof module;
}
if (tmp2) {
tmp2 = module;
}
if (tmp2) {
tmp2 = !module.nodeType;
}
if (tmp2) {
tmp2 = module;
}
let _Buffer;
if (tmp2) {
if (tmp2.exports === tmp) {
2026-07-23 10:11:24 +00:00
_Buffer = require("module_580").Buffer;
2026-07-20 16:05:17 +00:00
}
}
let allocUnsafe;
if (_Buffer) {
allocUnsafe = _Buffer.allocUnsafe;
}
export default function cloneBuffer(arr) {
if (arg1) {
return arr.slice();
} else {
if (allocUnsafe) {
let constructor = allocUnsafe(length);
} else {
constructor = arr.constructor;
const prototype = constructor.prototype;
constructor = new constructor(length);
}
arr.copy(constructor);
return constructor;
}
};