mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
278aae28e1
Fixes: https://github.com/nodejs/node/issues/27253 PR-URL: https://github.com/nodejs/node/pull/33516 Reviewed-By: Anna Henningsen <anna@addaleax.net>
26 lines
663 B
JavaScript
26 lines
663 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const zlib = require('zlib');
|
|
|
|
const encoded = Buffer.from('G38A+CXCIrFAIAM=', 'base64');
|
|
|
|
// Async
|
|
zlib.brotliDecompress(encoded, { maxOutputLength: 64 }, common.expectsError({
|
|
code: 'ERR_BUFFER_TOO_LARGE',
|
|
message: 'Cannot create a Buffer larger than 64 bytes'
|
|
}));
|
|
|
|
// Sync
|
|
assert.throws(function() {
|
|
zlib.brotliDecompressSync(encoded, { maxOutputLength: 64 });
|
|
}, RangeError);
|
|
|
|
// Async
|
|
zlib.brotliDecompress(encoded, { maxOutputLength: 256 }, function(err) {
|
|
assert.strictEqual(err, null);
|
|
});
|
|
|
|
// Sync
|
|
zlib.brotliDecompressSync(encoded, { maxOutputLength: 256 });
|