샘플
minizlib 3.1.0: compress and decompress data using minizlib Gzip and Gunzip streams
검증된 샘플 — npm minizlib 3.1.0: compress and decompress data using minizlib Gzip and Gunzip streams. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다.
sha256:867f0794653070fe38765517c2734750f5bea7d73308b69390c4ffc9efe03ffa
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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-28 |
케이스
HOW- 목표
- compress and decompress data using minizlib Gzip and Gunzip streams
- 패키지
- 심벌
-
- minizlib.Gunzip
- minizlib.Gzip
- 환경
- node 22.23.2
- 생성일
- 2026-08-28T05:35:31Z
컨트랙트
- Gzip and Gunzip classes are exported and instantiate stream instances extending Zlib
- Gzip synchronously compresses string or buffer into gzip formatted buffer with magic bytes 0x1f 0x8b
- Gunzip synchronously decompresses gzip buffer back to the original content
- Gzip piped into Gunzip processes data through stream pipeline asynchronously
- Gunzip raises ZlibError when consuming invalid or corrupted compressed input
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
소스
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: compress and decompress data using minizlib Gzip and Gunzip streams
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/minizlib@3.1.0
Demonstrate these symbols/APIs:
- minizlib.Gunzip
- minizlib.Gzip
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:ce021948e986b7e97843d5d9ab7d32dbd600772ddd521e7e2365da2fff5656e7","contract":["Gzip and Gunzip classes are exported and instantiate stream instances extending Zlib","Gzip synchronously compresses string or buffer into gzip formatted buffer with magic bytes 0x1f 0x8b","Gunzip synchronously decompresses gzip buffer back to the original content","Gzip piped into Gunzip processes data through stream pipeline asynchronously","Gunzip raises ZlibError when consuming invalid or corrupted compressed input"],"goal":"compress and decompress data using minizlib Gzip and Gunzip streams","kind":"HOW","packages":["pkg:npm/minizlib@3.1.0"],"schemaVersion":1,"symbols":["minizlib.Gunzip","minizlib.Gzip"]},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/minizlib@3.1.0"],"schemaVersion":1,"subject":"pkg:npm/minizlib@3.1.0","symbols":["minizlib.Gunzip","minizlib.Gzip"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-minizlib-gzip-gunzip",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-minizlib-gzip-gunzip",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"minizlib": "3.1.0"
}
},
"node_modules/minipass": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
"integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
"license": "BlueOak-1.0.0",
"engines": {
"node": ">=16 || 14 >=14.17"
}
},
"node_modules/minizlib": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz",
"integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==",
"license": "MIT",
"dependencies": {
"minipass": "^7.1.2"
},
"engines": {
"node": ">= 18"
}
}
}
}
{
"name": "sample-minizlib-gzip-gunzip",
"version": "1.0.0",
"private": true,
"type": "module",
"description": "Clean-room verification for minizlib Gzip and Gunzip streams",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"minizlib": "3.1.0"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "compress and decompress data using minizlib Gzip and Gunzip streams",
"kind": "HOW",
"packages": [
"pkg:npm/minizlib@3.1.0"
],
"symbols": [
"minizlib.Gunzip",
"minizlib.Gzip"
]
}
import { Gzip, Gunzip, Zlib, ZlibError } from 'minizlib';
/**
* Compresses data synchronously using minizlib Gzip.
* @param {string | Buffer} data
* @param {import('zlib').ZlibOptions} [options]
* @returns {Buffer}
*/
export function gzipSync(data, options) {
const zip = new Gzip(options);
zip.end(data);
return zip.read();
}
/**
* Decompresses gzip data synchronously using minizlib Gunzip.
* @param {Buffer} data
* @param {import('zlib').ZlibOptions} [options]
* @returns {Buffer}
*/
export function gunzipSync(data, options) {
const unzip = new Gunzip(options);
unzip.end(data);
return unzip.read();
}
/**
* Creates a configured Gzip compression stream.
* @param {import('zlib').ZlibOptions} [options]
* @returns {Gzip}
*/
export function createGzipStream(options) {
return new Gzip(options);
}
/**
* Creates a configured Gunzip decompression stream.
* @param {import('zlib').ZlibOptions} [options]
* @returns {Gunzip}
*/
export function createGunzipStream(options) {
return new Gunzip(options);
}
export { Gzip, Gunzip, Zlib, ZlibError };
import assert from 'node:assert/strict';
import {
Gzip,
Gunzip,
Zlib,
ZlibError,
gzipSync,
gunzipSync,
createGzipStream,
createGunzipStream,
} from '../src/index.js';
// 1. Gzip and Gunzip classes are exported and instantiate stream instances extending Zlib
assert.equal(typeof Gzip, 'function', 'Gzip must be a constructor function');
assert.equal(typeof Gunzip, 'function', 'Gunzip must be a constructor function');
const gzipInstance = new Gzip();
const gunzipInstance = new Gunzip();
assert.ok(gzipInstance instanceof Zlib, 'Gzip must inherit from Zlib');
assert.ok(gunzipInstance instanceof Zlib, 'Gunzip must inherit from Zlib');
// 2. Gzip synchronously compresses string or buffer into gzip formatted buffer with magic bytes 0x1f 0x8b
const sampleText = 'CodeSampleX minizlib stream contract verification payload 12345';
const compressedBuffer = gzipSync(sampleText);
assert.ok(Buffer.isBuffer(compressedBuffer), 'Compressed output must be a Buffer');
assert.ok(compressedBuffer.length > 0, 'Compressed output must not be empty');
assert.equal(compressedBuffer[0], 0x1f, 'Gzip magic byte 0 must be 0x1f');
assert.equal(compressedBuffer[1], 0x8b, 'Gzip magic byte 1 must be 0x8b');
// 3. Gunzip synchronously decompresses gzip buffer back to the original content
const decompressedBuffer = gunzipSync(compressedBuffer);
assert.ok(Buffer.isBuffer(decompressedBuffer), 'Decompressed output must be a Buffer');
assert.equal(decompressedBuffer.toString('utf8'), sampleText, 'Decompressed text must match original');
// 4. Gzip piped into Gunzip processes data through stream pipeline asynchronously
const zipStream = createGzipStream();
const unzipStream = createGunzipStream();
zipStream.pipe(unzipStream);
const receivedChunks = [];
unzipStream.on('data', chunk => receivedChunks.push(chunk));
await new Promise((resolve, reject) => {
unzipStream.on('end', () => {
const pipedResult = Buffer.concat(receivedChunks).toString('utf8');
assert.equal(pipedResult, sampleText, 'Stream piped result must match original payload');
resolve();
});
zipStream.on('error', reject);
unzipStream.on('error', reject);
zipStream.end(sampleText);
});
// 5. Gunzip raises ZlibError when consuming invalid or corrupted compressed input
let caughtError = null;
try {
gunzipSync(Buffer.from('not valid compressed gzip payload'));
} catch (err) {
caughtError = err;
}
assert.ok(caughtError !== null, 'Gunzip must throw an error on invalid compressed input');
assert.ok(caughtError instanceof Error, 'Thrown error must be an instance of Error');
assert.ok(
caughtError instanceof ZlibError || caughtError.code !== undefined || caughtError.message.length > 0,
'Error must have diagnostic details'
);
console.log('All minizlib contract assertions passed successfully.');
오리진 시더
익명