Server IP : 150.95.80.236 / Your IP : 18.226.186.172 Web Server : Apache System : Linux host-150-95-80-236 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : social-telecare ( 10000) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/pcu.in.th/api-uat.pcu.in.th/node_modules/superagent/lib/node/ |
Upload File : |
"use strict"; /** * Module dependencies. */ const _require = require('string_decoder'), StringDecoder = _require.StringDecoder; const Stream = require('stream'); const zlib = require('zlib'); /** * Buffers response data events and re-emits when they're unzipped. * * @param {Request} req * @param {Response} res * @api private */ exports.unzip = (request, res) => { const unzip = zlib.createUnzip(); const stream = new Stream(); let decoder; // make node responseOnEnd() happy stream.req = request; unzip.on('error', error => { if (error && error.code === 'Z_BUF_ERROR') { // unexpected end of file is ignored by browsers and curl stream.emit('end'); return; } stream.emit('error', error); }); // pipe to unzip res.pipe(unzip); // override `setEncoding` to capture encoding res.setEncoding = type => { decoder = new StringDecoder(type); }; // decode upon decompressing with captured encoding unzip.on('data', buf => { if (decoder) { const string_ = decoder.write(buf); if (string_.length > 0) stream.emit('data', string_); } else { stream.emit('data', buf); } }); unzip.on('end', () => { stream.emit('end'); }); // override `on` to capture data listeners const _on = res.on; res.on = function (type, fn) { if (type === 'data' || type === 'end') { stream.on(type, fn.bind(res)); } else if (type === 'error') { stream.on(type, fn.bind(res)); _on.call(res, type, fn); } else { _on.call(res, type, fn); } return this; }; }; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVxdWlyZSIsInJlcXVpcmUiLCJTdHJpbmdEZWNvZGVyIiwiU3RyZWFtIiwiemxpYiIsImV4cG9ydHMiLCJ1bnppcCIsInJlcXVlc3QiLCJyZXMiLCJjcmVhdGVVbnppcCIsInN0cmVhbSIsImRlY29kZXIiL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