サンプル
bare-stream 2.13.3: PassThrough
検証済みサンプル — npm bare-stream 2.13.3: PassThrough. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: PassThrough forwards written string chunks…
sha256:689dc33496248f851d229e99fa24177182a0284611449a4172f3cdd19b11db4b
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
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-27 |
ケース
HOW- ゴール
- verify bare-stream.PassThrough in pkg:npm/bare-stream@2.13.3
- パッケージ
- シンボル
-
- bare-stream.PassThrough
- 環境
- node 22.23.2
- 作成日
- 2026-08-27T13:22:07Z
コントラクト
- PassThrough forwards written string chunks unmodified to readable stream listeners
- PassThrough supports streaming piping between readable and writable streams
- PassThrough supports backpressure and pause/resume stream flow control
- PassThrough integrates with pipeline utility for multi-stream chaining
- PassThrough emits finish event when writing ends and end event when reading completes
- PassThrough emits error and close events when destroyed with an error
ファイル
- 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 bare-stream.PassThrough in pkg:npm/bare-stream@2.13.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bare-stream@2.13.3
Demonstrate these symbols/APIs:
- bare-stream.PassThrough
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:14f3d5499ad8c3142eb035130845db52b5c64cf9fde501e0a90b8d828501e1f4","constraints":{"executionContext":"node"},"contract":["PassThrough forwards written string chunks unmodified to readable stream listeners","PassThrough supports streaming piping between readable and writable streams","PassThrough supports backpressure and pause/resume stream flow control","PassThrough integrates with pipeline utility for multi-stream chaining","PassThrough emits finish event when writing ends and end event when reading completes","PassThrough emits error and close events when destroyed with an error"],"goal":"verify bare-stream.PassThrough in pkg:npm/bare-stream@2.13.3","kind":"HOW","packages":["pkg:npm/bare-stream@2.13.3"],"schemaVersion":1,"symbols":["bare-stream.PassThrough"]},"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/bare-stream@2.13.3"],"schemaVersion":1,"subject":"pkg:npm/bare-stream@2.13.3","symbols":["bare-stream.PassThrough"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-bare-stream-passthrough",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-bare-stream-passthrough",
"version": "1.0.0",
"dependencies": {
"bare-stream": "2.13.3"
}
},
"node_modules/b4a": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/b4a/-/b4a-1.8.1.tgz",
"integrity": "sha512-aiqre1Nr0B/6DgE2N5vwTc+2/oQZ4Wh1t4NznYY4E00y8LCt6NqdRv81so00oo27D8MVKTpUa/MwUUtBLXCoDw==",
"license": "Apache-2.0",
"peerDependencies": {
"react-native-b4a": "*"
},
"peerDependenciesMeta": {
"react-native-b4a": {
"optional": true
}
}
},
"node_modules/bare-events": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.9.2.tgz",
"integrity": "sha512-AIPKioV7/Y/8KfZ3AAhjPJxLLbY49S64Ym5DakZlUg75qQiTgUq9hEJoEwa4eUezPUlXRy/i5NpsKvo9jgKmoA==",
"license": "Apache-2.0",
"peerDependencies": {
"bare-abort-controller": "*"
},
"peerDependenciesMeta": {
"bare-abort-controller": {
"optional": true
}
}
},
"node_modules/bare-stream": {
"version": "2.13.3",
"resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.13.3.tgz",
"integrity": "sha512-Kc+brLqvEqGkjyfiwJmImAOqLZL7OsoLKuavx+hJjgVV3nLTOjloJyPMFxjUPerGGHrNH0fLU06jjykMLWrERQ==",
"license": "Apache-2.0",
"dependencies": {
"b4a": "^1.8.1",
"streamx": "^2.25.0",
"teex": "^1.0.1"
},
"peerDependencies": {
"bare-abort-controller": "*",
"bare-buffer": "*",
"bare-events": "*"
},
"peerDependenciesMeta": {
"bare-abort-controller": {
"optional": true
},
"bare-buffer": {
"optional": true
},
"bare-events": {
"optional": true
}
}
},
"node_modules/events-universal": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz",
"integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==",
"license": "Apache-2.0",
"dependencies": {
"bare-events": "^2.7.0"
}
},
"node_modules/fast-fifo": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
"integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==",
"license": "MIT"
},
"node_modules/streamx": {
"version": "2.28.1",
"resolved": "https://registry.npmjs.org/streamx/-/streamx-2.28.1.tgz",
"integrity": "sha512-zEzXb0s5Cds7tqMH6rhZ05lcJydCWiQPEwiNngVqzsxCc962vLY4Uw+mW7od8kDH258k2Uz/JrOkdIAAhSh9VA==",
"license": "MIT",
"dependencies": {
"events-universal": "^1.0.0",
"fast-fifo": "^1.3.2",
"text-decoder": "^1.1.0"
}
},
"node_modules/teex": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz",
"integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==",
"license": "MIT",
"dependencies": {
"streamx": "^2.12.5"
}
},
"node_modules/text-decoder": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.7.tgz",
"integrity": "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ==",
"license": "Apache-2.0",
"dependencies": {
"b4a": "^1.6.4"
}
}
}
}
{
"name": "sample-bare-stream-passthrough",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"bare-stream": "2.13.3"
}
}
{
"schemaVersion": 1,
"goal": "verify bare-stream.PassThrough in pkg:npm/bare-stream@2.13.3",
"kind": "HOW",
"packages": [
"pkg:npm/bare-stream@2.13.3"
],
"symbols": [
"bare-stream.PassThrough"
],
"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 {
PassThrough,
Readable,
Writable,
pipeline,
isStream,
isReadable,
isWritable,
isEnded,
isFinished
} from 'bare-stream';
// 1. PassThrough forwards written string chunks unmodified to readable stream listeners
await new Promise((resolve, reject) => {
const pass = new PassThrough();
const chunks = [];
assert.equal(isStream(pass), true);
assert.equal(isReadable(pass), true);
assert.equal(isWritable(pass), true);
pass.on('data', (chunk) => {
chunks.push(chunk.toString());
});
pass.on('end', () => {
try {
assert.deepEqual(chunks, ['hello ', 'world']);
assert.equal(isEnded(pass), true);
resolve();
} catch (err) {
reject(err);
}
});
pass.on('error', reject);
pass.write('hello ');
pass.end('world');
});
// 2. PassThrough supports streaming piping between readable and writable streams
await new Promise((resolve, reject) => {
let index = 0;
const items = ['stream', 'data', 'transfer'];
const src = new Readable({
read() {
if (index < items.length) {
this.push(items[index++]);
} else {
this.push(null);
}
}
});
const pass = new PassThrough();
const collected = [];
const dest = new Writable({
write(chunk, encoding, cb) {
collected.push(chunk.toString());
cb(null);
}
});
dest.on('finish', () => {
try {
assert.deepEqual(collected, ['stream', 'data', 'transfer']);
assert.equal(isFinished(dest), true);
resolve();
} catch (err) {
reject(err);
}
});
dest.on('error', reject);
pass.on('error', reject);
src.on('error', reject);
src.pipe(pass).pipe(dest);
});
// 3. PassThrough supports backpressure and pause/resume stream flow control
await new Promise((resolve, reject) => {
const pass = new PassThrough({ highWaterMark: 16 });
const received = [];
pass.pause();
pass.write('buffered-chunk');
// Should not emit data while paused
pass.on('data', (chunk) => {
received.push(chunk.toString());
});
assert.equal(received.length, 0);
pass.resume();
// After resume, buffered data is delivered
setImmediate(() => {
try {
assert.equal(received.length, 1);
assert.equal(received[0], 'buffered-chunk');
resolve();
} catch (err) {
reject(err);
}
});
});
// 4. PassThrough integrates with pipeline utility for multi-stream chaining
await new Promise((resolve, reject) => {
let count = 0;
const words = ['pipe', 'line', 'test'];
const src = new Readable({
read() {
if (count < words.length) {
this.push(words[count++]);
} else {
this.push(null);
}
}
});
const pass1 = new PassThrough();
const pass2 = new PassThrough();
const result = [];
const dest = new Writable({
write(chunk, encoding, cb) {
result.push(chunk.toString());
cb(null);
}
});
pipeline(src, pass1, pass2, dest, (err) => {
if (err) return reject(err);
try {
assert.deepEqual(result, ['pipe', 'line', 'test']);
resolve();
} catch (e) {
reject(e);
}
});
});
// 5. PassThrough emits finish event when writing ends and end event when reading completes
await new Promise((resolve, reject) => {
const pass = new PassThrough();
let finishFired = false;
let endFired = false;
pass.on('finish', () => {
finishFired = true;
assert.equal(isFinished(pass), true);
});
pass.on('data', () => {});
pass.on('end', () => {
endFired = true;
try {
assert.equal(finishFired, true);
assert.equal(endFired, true);
assert.equal(isEnded(pass), true);
resolve();
} catch (err) {
reject(err);
}
});
pass.on('error', reject);
pass.write('testing');
pass.end();
});
// 6. PassThrough emits error and close events when destroyed with an error
await new Promise((resolve, reject) => {
const pass = new PassThrough();
let errorReceived = null;
pass.on('error', (err) => {
errorReceived = err;
});
pass.on('close', () => {
try {
assert.ok(errorReceived);
assert.equal(errorReceived.message, 'passthrough failure');
assert.equal(pass.destroyed, true);
resolve();
} catch (err) {
reject(err);
}
});
pass.destroy(new Error('passthrough failure'));
});
オリジンシーダー
匿名