xref: /third_party/node/test/fixtures/snapshot/decompress-gzip-sync.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/fixtures/snapshot/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst zlib = require('zlib');
41cb0ef41Sopenharmony_ciconst fs = require('fs');
51cb0ef41Sopenharmony_ciconst assert = require('assert');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst fixture = process.env.NODE_TEST_FIXTURE;
81cb0ef41Sopenharmony_ciconst mode = process.env.NODE_TEST_MODE;
91cb0ef41Sopenharmony_ciconst file = fs.readFileSync(fixture);
101cb0ef41Sopenharmony_ciconst result = zlib.gunzipSync(file);
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciconsole.log(`Result length = ${result.byteLength}`);
131cb0ef41Sopenharmony_ciconsole.log('NODE_TEST_MODE:', mode);
141cb0ef41Sopenharmony_ciif (mode === 'snapshot') {
151cb0ef41Sopenharmony_ci  globalThis.NODE_TEST_DATA = result;
161cb0ef41Sopenharmony_ci} else if (mode === 'verify') {
171cb0ef41Sopenharmony_ci  assert.deepStrictEqual(globalThis.NODE_TEST_DATA, result);
181cb0ef41Sopenharmony_ci} else {
191cb0ef41Sopenharmony_ci  assert.fail('Unknown mode');
201cb0ef41Sopenharmony_ci}
21

Indexes created Thu Nov 07 10:32:03 CST 2024