1234567891011121314151617181920212223242526272829303132333435 |
- var root = require('./_root');
- var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
- var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
- var moduleExports = freeModule && freeModule.exports === freeExports;
- var Buffer = moduleExports ? root.Buffer : undefined,
- allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
- function cloneBuffer(buffer, isDeep) {
- if (isDeep) {
- return buffer.slice();
- }
- var length = buffer.length,
- result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
- buffer.copy(result);
- return result;
- }
- module.exports = cloneBuffer;
|