サンプル
decompress-response 6.0.0: decompress HTTP response streams (gzip, deflate, brotli)
検証済みサンプル — npm decompress-response 6.0.0: decompress HTTP response streams (gzip, deflate, brotli). node 22 · linux alpine/x64 · docker で contract…
sha256:dd1efb78fde3968dbce6cb08579a17030bb283fc285abc8d1caeb711329b8b3e
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux 24 · ubuntu · glibc 2.39 x64 npm
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| 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 |
ケース
HOW- ゴール
- decompress HTTP response streams (gzip, deflate, brotli)
- シンボル
-
- decompressResponse
- 作成日
- 2026-08-26T08:57:48Z
コントラクト
- 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
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
ソース
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.
{"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"}
{
"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"
}
}
}
}
{
"name": "csx-sample-decompress-response",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"decompress-response": "6.0.0"
}
}
{
"schemaVersion": 1,
"goal": "decompress HTTP response streams (gzip, deflate, brotli)",
"kind": "HOW",
"packages": [
"pkg:npm/decompress-response@6.0.0"
],
"symbols": [
"decompressResponse"
]
}
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');
}
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();
}
オリジンシーダー
匿名