サンプル
readable-stream 2.3.8
検証済みサンプル — npm readable-stream 2.3.8. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: Readable stream emits data and end events when chunks are…
sha256:864a798828061a4f999b555a2fdea960cd817b9c975a6a3d8980db698b284529
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。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-23 |
ケース
HOW- ゴール
- verify pkg:npm/readable-stream@2.3.8
- パッケージ
- 作成日
- 2026-08-23T13:47:32Z
コントラクト
- Readable stream emits data and end events when chunks are pushed and ended
- Writable stream buffers written chunks and invokes callback upon finishing
- Transform stream transforms chunks in _transform and passes output downstream
- PassThrough stream passes input chunks directly through unmodified to reader
- Duplex stream independently reads and writes data through duplex channels
- Readable stream handles error events and propagates them to error listeners
ファイル
- 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/readable-stream@2.3.8
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/readable-stream@2.3.8
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:ae8e9569612bf7b1efa013ad8c0f11ee656b79cb0b536baf621ff1727f809b24","contract":["Readable stream emits data and end events when chunks are pushed and ended","Writable stream buffers written chunks and invokes callback upon finishing","Transform stream transforms chunks in _transform and passes output downstream","PassThrough stream passes input chunks directly through unmodified to reader","Duplex stream independently reads and writes data through duplex channels","Readable stream handles error events and propagates them to error listeners"],"goal":"verify pkg:npm/readable-stream@2.3.8","kind":"HOW","packages":["pkg:npm/readable-stream@2.3.8"],"schemaVersion":1},"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/readable-stream@2.3.8"],"schemaVersion":1,"subject":"pkg:npm/readable-stream@2.3.8","verifierAdapter":"node-typescript@1"}
{
"name": "sample-readable-stream",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-readable-stream",
"version": "1.0.0",
"dependencies": {
"readable-stream": "2.3.8"
}
},
"node_modules/core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
"license": "MIT"
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"license": "ISC"
},
"node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"license": "MIT"
},
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
"license": "MIT"
},
"node_modules/readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"license": "MIT",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"license": "MIT"
},
"node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"license": "MIT"
}
}
}
{
"name": "sample-readable-stream",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"readable-stream": "2.3.8"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/readable-stream@2.3.8",
"kind": "HOW",
"packages": [
"pkg:npm/readable-stream@2.3.8"
]
}
import assert from 'node:assert/strict';
import { Readable, Writable, Transform, PassThrough, Duplex } from 'readable-stream';
// 1. Readable stream emits data and end events when chunks are pushed and ended
await new Promise((resolve, reject) => {
const chunks = [];
const readable = new Readable({
read() {}
});
readable.on('data', (chunk) => {
chunks.push(chunk.toString());
});
readable.on('end', () => {
try {
assert.deepEqual(chunks, ['hello', 'world']);
resolve();
} catch (err) {
reject(err);
}
});
readable.on('error', reject);
readable.push('hello');
readable.push('world');
readable.push(null);
});
// 2. Writable stream buffers written chunks and invokes callback upon finishing
await new Promise((resolve, reject) => {
const received = [];
const writable = new Writable({
write(chunk, encoding, callback) {
received.push(chunk.toString());
callback();
}
});
writable.on('finish', () => {
try {
assert.deepEqual(received, ['alpha', 'beta']);
resolve();
} catch (err) {
reject(err);
}
});
writable.on('error', reject);
writable.write('alpha');
writable.write('beta');
writable.end();
});
// 3. Transform stream transforms chunks in _transform and passes output downstream
await new Promise((resolve, reject) => {
const upperTransform = new Transform({
transform(chunk, encoding, callback) {
callback(null, chunk.toString().toUpperCase());
}
});
const output = [];
upperTransform.on('data', (chunk) => {
output.push(chunk.toString());
});
upperTransform.on('end', () => {
try {
assert.deepEqual(output, ['HELLO', 'WORLD']);
resolve();
} catch (err) {
reject(err);
}
});
upperTransform.on('error', reject);
upperTransform.write('hello');
upperTransform.write('world');
upperTransform.end();
});
// 4. PassThrough stream passes input chunks directly through unmodified to reader
await new Promise((resolve, reject) => {
const pass = new PassThrough();
const output = [];
pass.on('data', (chunk) => {
output.push(chunk.toString());
});
pass.on('end', () => {
try {
assert.deepEqual(output, ['raw-data']);
resolve();
} catch (err) {
reject(err);
}
});
pass.on('error', reject);
pass.write('raw-data');
pass.end();
});
// 5. Duplex stream independently reads and writes data through duplex channels
await new Promise((resolve, reject) => {
const readData = [];
const writtenData = [];
const duplex = new Duplex({
read() {
this.push('stream-read');
this.push(null);
},
write(chunk, encoding, callback) {
writtenData.push(chunk.toString());
callback();
}
});
duplex.on('data', (chunk) => {
readData.push(chunk.toString());
});
let ended = false;
let finished = false;
function checkDone() {
if (ended && finished) {
try {
assert.deepEqual(readData, ['stream-read']);
assert.deepEqual(writtenData, ['stream-write']);
resolve();
} catch (err) {
reject(err);
}
}
}
duplex.on('end', () => {
ended = true;
checkDone();
});
duplex.on('finish', () => {
finished = true;
checkDone();
});
duplex.on('error', reject);
duplex.write('stream-write');
duplex.end();
});
// 6. Readable stream handles error events and propagates them to error listeners
await new Promise((resolve, reject) => {
const readable = new Readable({
read() {
this.emit('error', new Error('test-stream-error'));
}
});
readable.on('error', (err) => {
try {
assert.equal(err.message, 'test-stream-error');
resolve();
} catch (e) {
reject(e);
}
});
readable.resume();
});
オリジンシーダー
匿名