|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
364 bytes
|
| Line | |
|---|
| 1 | var MIN_SIZE = 16 * 1024;
|
|---|
| 2 | var SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported
|
|---|
| 3 |
|
|---|
| 4 | module.exports = function adoptBuffer(buffer, size) {
|
|---|
| 5 | if (buffer === null || buffer.length < size) {
|
|---|
| 6 | return new SafeUint32Array(Math.max(size + 1024, MIN_SIZE));
|
|---|
| 7 | }
|
|---|
| 8 |
|
|---|
| 9 | return buffer;
|
|---|
| 10 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.