function generate (input, output) { let raw = fs.readFileSync(input) if (input.endsWith('.gz')) { raw = zlib.gunzipSync(raw) } const spec = JSON.parse(raw) const client = new Client({ spec, backend: {} }) const kindsToGroups = setup(client) try { fs.mkdirSync(output) } catch (err) { if (err.code !== 'EEXIST') throw err } generateClient({ kindsToGroups, output }) Object.entries(kindsToGroups).forEach(([kindKey, groups]) => { generateKind({ kind: { kindKey, groups }, output }) }) }
'specs', `swagger-${options.version}.json.gz`) spec = JSON.parse(zlib.gunzipSync(fs.readFileSync(swaggerPath)))
function main (args) { let raw = fs.readFileSync(args.spec) if (args.spec.endsWith('.gz')) { raw = zlib.gunzipSync(raw)
function inflate_gzip(value) { return zlib.gunzipSync(value); }
describe('profile-encoded', () => { describe('encode', () => { it('should encode profile such that the encoded profile can be decoded', () => __awaiter(void 0, void 0, void 0, function* () { const encoded = yield profile_encoder_1.encode(profiles_for_tests_1.timeProfile); const unzipped = yield gunzip(encoded); const decoded = profile_1.perftools.profiles.Profile.decode(unzipped); assert.deepEqual(decoded, profiles_for_tests_1.decodedTimeProfile); })); }); describe('encodeSync', () => { it('should encode profile such that the encoded profile can be decoded', () => { const encoded = profile_encoder_1.encodeSync(profiles_for_tests_1.timeProfile); const unzipped = zlib_1.gunzipSync(encoded); const decoded = profile_1.perftools.profiles.Profile.decode(unzipped); assert.deepEqual(decoded, profiles_for_tests_1.decodedTimeProfile); }); }); });
async function getDerivativesF2D(item, token) { const manifestPath = item.basePath + 'manifest.json.gz'; const data = await getDerivative(manifestPath, token); const manifestData = zlib.gunzipSync(data); const manifest = JSON.parse(manifestData.toString('utf8')); if (!manifest.assets) { return []; } return manifest.assets .map(asset => asset.URI) .filter(uri => uri.indexOf('embed:/') === -1) .concat(['manifest.json.gz']); }
http.createServer((req, res) => { greenMsg('[REQUEST HEADER]'); console.log(req.headers); var options = url.parse(req.url); options.headers = req.headers; var proxyRequest = http.request(options, (proxyResponse) => { proxyResponse.on('data', (chunk) => { greenMsg('[RESPONSE BODY]'); console.log(zlib.gunzipSync(chunk).toString('utf8')); res.write(chunk, 'binary'); }); proxyResponse.on('end', () => { res.end();}); greenMsg('[RESPONSE HEADER]'); console.log(proxyResponse.statusCode, proxyResponse.headers); res.writeHead(proxyResponse.statusCode, proxyResponse.headers); }); req.on('data', (chunk) => { console.log(chunk); proxyRequest.write(chunk, 'binary'); }); req.on('end', () => { proxyRequest.end(); }); }).listen(8080);
const unzipBody = JSON.parse(zlib.gunzipSync(logger._tryToSend.getCall(0).args[0].body)); assert.equal(unzipBody.message, logMsg.message); assert.equal(unzipBody.extraField1, extraField1);
skip: !zlib.gunzipSync, isolate: 'child-process', timeout: TEST_TIMEOUT,
apiCalls.forEach(function (name) { test('should report ' + name, skip: name === 'Trace' && !zlib.gunzipSync, isolate: 'child-process', timeout: TEST_TIMEOUT,