샘플
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
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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();
}
오리진 시더
익명