11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst zlib = require('zlib'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst encoded = Buffer.from('G38A+CXCIrFAIAM=', 'base64'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci// Async 91cb0ef41Sopenharmony_cizlib.brotliDecompress(encoded, { maxOutputLength: 64 }, common.expectsError({ 101cb0ef41Sopenharmony_ci code: 'ERR_BUFFER_TOO_LARGE', 111cb0ef41Sopenharmony_ci message: 'Cannot create a Buffer larger than 64 bytes' 121cb0ef41Sopenharmony_ci})); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ci// Sync 151cb0ef41Sopenharmony_ciassert.throws(function() { 161cb0ef41Sopenharmony_ci zlib.brotliDecompressSync(encoded, { maxOutputLength: 64 }); 171cb0ef41Sopenharmony_ci}, RangeError); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ci// Async 201cb0ef41Sopenharmony_cizlib.brotliDecompress(encoded, { maxOutputLength: 256 }, function(err) { 211cb0ef41Sopenharmony_ci assert.strictEqual(err, null); 221cb0ef41Sopenharmony_ci}); 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ci// Sync 251cb0ef41Sopenharmony_cizlib.brotliDecompressSync(encoded, { maxOutputLength: 256 }); 26