Пример
minizlib 2.1.2
Проверенный пример — npm minizlib 2.1.2. Контракт выполнен на node 22 · linux alpine/x64 · docker и пройден: Gzip compresses input buffer and Gunzip…
sha256:39ed08176da92665cf4e7d5942ee056ad6ce93b6ce59a7c6d93aac84153b9685
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
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- Цель
- verify pkg:npm/minizlib@2.1.2
- Пакеты
- Окружение
- node 22.23.2
- Создан
- 2026-08-28T07:55:59Z
Контракт
- Gzip compresses input buffer and Gunzip decompresses back to original buffer
- Deflate and Inflate perform standard zlib compression and decompression
- DeflateRaw and InflateRaw handle raw deflate streams without zlib headers
- BrotliCompress compresses payload and BrotliDecompress restores original content
- Gunzip emits error event on malformed compressed payload
- Gzip respects compression level options from constants
Файлы
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- 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: verify pkg:npm/minizlib@2.1.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/minizlib@2.1.2
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:192d7df0884e76c7019aad5aeda1414c60becab860ea9e35dd33e2f694b1f06a","constraints":{"executionContext":"node"},"contract":["Gzip compresses input buffer and Gunzip decompresses back to original buffer","Deflate and Inflate perform standard zlib compression and decompression","DeflateRaw and InflateRaw handle raw deflate streams without zlib headers","BrotliCompress compresses payload and BrotliDecompress restores original content","Gunzip emits error event on malformed compressed payload","Gzip respects compression level options from constants"],"goal":"verify pkg:npm/minizlib@2.1.2","kind":"HOW","packages":["pkg:npm/minizlib@2.1.2"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","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@2.1.2"],"schemaVersion":1,"subject":"pkg:npm/minizlib@2.1.2","verifierAdapter":"node-typescript@1"}
{
"name": "sample-minizlib-verify",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-minizlib-verify",
"version": "1.0.0",
"dependencies": {
"minizlib": "2.1.2"
}
},
"node_modules/minipass": {
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
"integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
"license": "ISC",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/minizlib": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
"integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
"license": "MIT",
"dependencies": {
"minipass": "^3.0.0",
"yallist": "^4.0.0"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"license": "ISC"
}
}
}
{
"name": "sample-minizlib-verify",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"minizlib": "2.1.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/minizlib@2.1.2",
"kind": "HOW",
"packages": [
"pkg:npm/minizlib@2.1.2"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
Gzip,
Gunzip,
Deflate,
Inflate,
DeflateRaw,
InflateRaw,
BrotliCompress,
BrotliDecompress,
constants
} = require('minizlib');
// 1. Gzip compresses input and Gunzip decompresses back to original buffer
{
const input = Buffer.from('Hello CodeSampleX with minizlib gzip compression!');
const gzip = new Gzip();
gzip.end(input);
const compressed = gzip.read();
assert.ok(Buffer.isBuffer(compressed), 'Gzip output should be a Buffer');
assert.ok(compressed.length > 0, 'Gzip output should not be empty');
assert.strictEqual(compressed[0], 0x1f, 'First gzip magic byte should be 0x1f');
assert.strictEqual(compressed[1], 0x8b, 'Second gzip magic byte should be 0x8b');
const gunzip = new Gunzip();
gunzip.end(compressed);
const decompressed = gunzip.read();
assert.ok(Buffer.isBuffer(decompressed), 'Gunzip output should be a Buffer');
assert.strictEqual(decompressed.toString('utf8'), input.toString('utf8'), 'Decompressed content must match original input');
}
// 2. Deflate and Inflate perform standard zlib compression and decompression
{
const input = Buffer.from('Testing Deflate and Inflate with structured text payload 1234567890');
const deflate = new Deflate();
deflate.end(input);
const compressed = deflate.read();
assert.ok(Buffer.isBuffer(compressed), 'Deflate output should be a Buffer');
const inflate = new Inflate();
inflate.end(compressed);
const decompressed = inflate.read();
assert.strictEqual(decompressed.toString('utf8'), input.toString('utf8'), 'Inflate output must match deflate input');
}
// 3. DeflateRaw and InflateRaw handle raw deflate streams without zlib headers
{
const input = Buffer.from('Testing DeflateRaw and InflateRaw without headers');
const rawDeflate = new DeflateRaw();
rawDeflate.end(input);
const rawCompressed = rawDeflate.read();
assert.ok(Buffer.isBuffer(rawCompressed), 'DeflateRaw output should be a Buffer');
const rawInflate = new InflateRaw();
rawInflate.end(rawCompressed);
const decompressed = rawInflate.read();
assert.strictEqual(decompressed.toString('utf8'), input.toString('utf8'), 'InflateRaw output must match raw deflate input');
}
// 4. BrotliCompress compresses payload and BrotliDecompress restores original content
{
const input = Buffer.from('Testing BrotliCompress and BrotliDecompress in minizlib');
const brotliCompress = new BrotliCompress();
brotliCompress.end(input);
const compressed = brotliCompress.read();
assert.ok(Buffer.isBuffer(compressed), 'BrotliCompress output should be a Buffer');
const brotliDecompress = new BrotliDecompress();
brotliDecompress.end(compressed);
const decompressed = brotliDecompress.read();
assert.strictEqual(decompressed.toString('utf8'), input.toString('utf8'), 'BrotliDecompress must match original content');
}
// 5. Gunzip emits error event on malformed compressed payload
{
const gunzip = new Gunzip();
let errorCaught = null;
gunzip.on('error', (err) => {
errorCaught = err;
});
gunzip.end(Buffer.from('not valid gzip compressed data'));
assert.ok(errorCaught !== null, 'Gunzip should emit error on corrupt payload');
assert.strictEqual(errorCaught.code, 'Z_DATA_ERROR', 'Error code should be Z_DATA_ERROR');
}
// 6. Gzip respects compression level options from constants
{
const input = Buffer.from('Repeated payload '.repeat(100));
const fastZip = new Gzip({ level: constants.Z_BEST_SPEED });
fastZip.end(input);
const fastOut = fastZip.read();
const bestZip = new Gzip({ level: constants.Z_BEST_COMPRESSION });
bestZip.end(input);
const bestOut = bestZip.read();
const noCompZip = new Gzip({ level: constants.Z_NO_COMPRESSION });
noCompZip.end(input);
const noCompOut = noCompZip.read();
assert.ok(fastOut.length < noCompOut.length, 'Best speed compression should be smaller than no compression');
assert.ok(bestOut.length <= fastOut.length, 'Best compression should be smaller or equal to best speed');
}
console.log('All minizlib contract assertions passed.');
Исходный сидер
аноним