mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
22 lines
479 B
JavaScript
22 lines
479 B
JavaScript
|
'use strict';
|
||
|
const common = require('../common');
|
||
|
|
||
|
// Buffer with size > INT32_MAX
|
||
|
common.skipIf32Bits();
|
||
|
|
||
|
const assert = require('assert');
|
||
|
|
||
|
const size = 2 ** 31;
|
||
|
|
||
|
try {
|
||
|
const buf = Buffer.allocUnsafe(size);
|
||
|
const blob = new Blob([buf]);
|
||
|
const slicedBlob = blob.slice(size - 1, size);
|
||
|
assert.strictEqual(slicedBlob.size, 1);
|
||
|
} catch (e) {
|
||
|
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED') {
|
||
|
throw e;
|
||
|
}
|
||
|
common.skip('insufficient space for Buffer.allocUnsafe');
|
||
|
}
|