CodeSampleX

Sample

decompress-response 6.0.0: decompress HTTP response streams (gzip, deflate, brotli)

Verified sample for npm decompress-response 6.0.0: decompress HTTP response streams (gzip, deflate, brotli). The contract ran on node 22 · linux alpine/x64 …

sha256:dd1efb78fde3968dbce6cb08579a17030bb283fc285abc8d1caeb711329b8b3e

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment linux 24 · ubuntu · glibc 2.39 x64 npm

Verification-run environments

Environment Contract Stages Run
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5…
2026-08-26

Case

HOW
Goal
decompress HTTP response streams (gzip, deflate, brotli)
Packages
Symbols
  • decompressResponse
Created
2026-08-26T08:57:48Z

Contract

  1. decompressResponse transparently decompresses gzip encoded response streams
  2. decompressResponse transparently decompresses deflate encoded response streams
  3. decompressResponse transparently decompresses brotli encoded response streams
  4. decompressResponse returns the stream unmodified for uncompressed responses
  5. decompressResponse preserves response status code and headers via mimic-response

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.mjs
  • test/contract.mjs

Download the source artifact (tar.gz)

Source

PROMPT.md
Clean-room public code sample — generation instructions

Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.

A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.

Goal: decompress HTTP response streams (gzip, deflate, brotli)
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/decompress-response@6.0.0
Demonstrate these symbols/APIs:
  - decompressResponse

Rules:
  - One focused purpose; the smallest project that proves the goal.
  - Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
  - Pin every dependency with a lockfile so resolution is reproducible.
  - No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
  - No personal names, emails, company names, or project identifiers of any kind.
  - No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
  - Keep it under 200 files and 256KB packed.
csx.json
{"case":{"caseId":"case:sha256:5ef7b84961ad2dc875a5d6c8f4829fbbf8dc0b3f702a9146b0995bd2dbea2842","contract":["decompressResponse transparently decompresses gzip encoded response streams","decompressResponse transparently decompresses deflate encoded response streams","decompressResponse transparently decompresses brotli encoded response streams","decompressResponse returns the stream unmodified for uncompressed responses","decompressResponse preserves response status code and headers via mimic-response"],"goal":"decompress HTTP response streams (gzip, deflate, brotli)","kind":"HOW","packages":["pkg:npm/decompress-response@6.0.0"],"schemaVersion":1,"symbols":["decompressResponse"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/decompress-response@6.0.0"],"schemaVersion":1,"subject":"pkg:npm/decompress-response@6.0.0","symbols":["decompressResponse"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "csx-sample-decompress-response",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "csx-sample-decompress-response",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "decompress-response": "6.0.0"
      }
    },
    "node_modules/decompress-response": {
      "version": "6.0.0",
      "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
      "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
      "license": "MIT",
      "dependencies": {
        "mimic-response": "^3.1.0"
      },
      "engines": {
        "node": ">=10"
      },
      "funding": {
        "url": "https://github.com/sponsors/sindresorhus"
      }
    },
    "node_modules/mimic-response": {
      "version": "3.1.0",
      "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
      "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
      "license": "MIT",
      "engines": {
        "node": ">=10"
      },
      "funding": {
        "url": "https://github.com/sponsors/sindresorhus"
      }
    }
  }
}
package.json
{
  "name": "csx-sample-decompress-response",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "decompress-response": "6.0.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "decompress HTTP response streams (gzip, deflate, brotli)",
  "kind": "HOW",
  "packages": [
    "pkg:npm/decompress-response@6.0.0"
  ],
  "symbols": [
    "decompressResponse"
  ]
}
src/index.mjs
import decompressResponse from 'decompress-response';

export function wrapResponse(response) {
  return decompressResponse(response);
}

export async function readDecompressedBody(response) {
  const stream = decompressResponse(response);
  const chunks = [];
  for await (const chunk of stream) {
    chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk);
  }
  return Buffer.concat(chunks).toString('utf8');
}
test/contract.mjs
import { strict as assert } from 'node:assert';
import http from 'node:http';
import zlib from 'node:zlib';
import { readDecompressedBody, wrapResponse } from '../src/index.mjs';

function startServer() {
  return new Promise((resolve) => {
    const server = http.createServer((req, res) => {
      const url = new URL(req.url, 'http://localhost');
      const type = url.searchParams.get('type');
      const payload = 'Decompressed HTTP response payload test string';

      if (type === 'gzip') {
        res.writeHead(200, { 'content-encoding': 'gzip', 'content-type': 'text/plain' });
        res.end(zlib.gzipSync(Buffer.from(payload)));
      } else if (type === 'deflate') {
        res.writeHead(200, { 'content-encoding': 'deflate', 'content-type': 'text/plain' });
        res.end(zlib.deflateSync(Buffer.from(payload)));
      } else if (type === 'br') {
        res.writeHead(200, { 'content-encoding': 'br', 'content-type': 'text/plain' });
        res.end(zlib.brotliCompressSync(Buffer.from(payload)));
      } else if (type === 'none') {
        res.writeHead(200, { 'content-type': 'text/plain' });
        res.end(payload);
      } else if (type === 'empty') {
        res.writeHead(204);
        res.end();
      }
    });

    server.listen(0, '127.0.0.1', () => {
      const port = server.address().port;
      resolve({ server, port });
    });
  });
}

const { server, port } = await startServer();
const expected = 'Decompressed HTTP response payload test string';

function request(path) {
  return new Promise((resolve, reject) => {
    http.get(`http://localhost:${port}${path}`, resolve).on('error', reject);
  });
}

try {
  // Contract 1: decompressResponse transparently decompresses gzip encoded response streams
  {
    const res = await request('/?type=gzip');
    const body = await readDecompressedBody(res);
    assert.equal(body, expected);
  }

  // Contract 2: decompressResponse transparently decompresses deflate encoded response streams
  {
    const res = await request('/?type=deflate');
    const body = await readDecompressedBody(res);
    assert.equal(body, expected);
  }

  // Contract 3: decompressResponse transparently decompresses brotli encoded response streams
  {
    const res = await request('/?type=br');
    const body = await readDecompressedBody(res);
    assert.equal(body, expected);
  }

  // Contract 4: decompressResponse returns the stream unmodified for uncompressed responses
  {
    const res = await request('/?type=none');
    const wrapped = wrapResponse(res);
    assert.equal(wrapped, res);
    const body = await readDecompressedBody(res);
    assert.equal(body, expected);
  }

  // Contract 5: decompressResponse preserves response status code and headers via mimic-response
  {
    const res = await request('/?type=gzip');
    const wrapped = wrapResponse(res);
    assert.equal(wrapped.statusCode, 200);
    assert.equal(wrapped.headers['content-encoding'], 'gzip');
    assert.equal(wrapped.headers['content-type'], 'text/plain');
  }

  console.log('CONTRACT PASS: decompressResponse successfully verified');
} finally {
  server.close();
}

Origin Seeder

anonymous