1'use strict'; 2const common = require('../common'); 3const assert = require('assert'); 4const zlib = require('zlib'); 5 6const encoded = Buffer.from('G38A+CXCIrFAIAM=', 'base64'); 7 8// Async 9zlib.brotliDecompress(encoded, { maxOutputLength: 64 }, common.expectsError({ 10 code: 'ERR_BUFFER_TOO_LARGE', 11 message: 'Cannot create a Buffer larger than 64 bytes' 12})); 13 14// Sync 15assert.throws(function() { 16 zlib.brotliDecompressSync(encoded, { maxOutputLength: 64 }); 17}, RangeError); 18 19// Async 20zlib.brotliDecompress(encoded, { maxOutputLength: 256 }, function(err) { 21 assert.strictEqual(err, null); 22}); 23 24// Sync 25zlib.brotliDecompressSync(encoded, { maxOutputLength: 256 }); 26