샘플
is-stream 2.0.1: verify isStream detects Node.js stream instances and differentiate readable writable duplex and transform streams
검증된 샘플 — npm is-stream 2.0.1: verify isStream detects Node.js stream instances and differentiate readable writable duplex and transform streams. node 22 …
sha256:9abcd1c6c50d4dfe47b76aa135f65821263e8e0ba491c84fd005f2ba7a9d12ea
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 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-23 |
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-07 |
케이스
HOW- 목표
- verify isStream detects Node.js stream instances and differentiate readable writable duplex and transform streams
- 패키지
- 심벌
-
- isStream
- isStream.duplex
- isStream.readable
- isStream.transform
- isStream.writable
- 환경
- node 22.23.2
- 생성일
- 2026-08-23T17:16:52Z
컨트랙트
- isStream returns true for Node.js Stream instances and objects with a pipe method, and false for primitives and plain objects
- isStream.readable returns true for readable streams including Readable, Duplex, and Transform, and false for purely Writable streams or non-streams
- isStream.writable returns true for writable streams including Writable, Duplex, and Transform, and false for purely Readable streams or non-streams
- isStream.duplex returns true for streams that are both readable and writable such as Duplex and Transform, and false for purely Readable or Writable streams
- isStream.transform returns true for Transform and PassThrough streams, and false for standard Duplex, Readable, or Writable streams
파일
- 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: verify isStream detects Node.js stream instances and differentiate readable writable duplex and transform streams
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/is-stream@2.0.1
Demonstrate these symbols/APIs:
- isStream
- isStream.duplex
- isStream.readable
- isStream.transform
- isStream.writable
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:225b415596d80df259b8372791405b51676ef3e427d40abab45a9509f67b54fe","constraints":{"executionContext":"node"},"contract":["isStream returns true for Node.js Stream instances and objects with a pipe method, and false for primitives and plain objects","isStream.readable returns true for readable streams including Readable, Duplex, and Transform, and false for purely Writable streams or non-streams","isStream.writable returns true for writable streams including Writable, Duplex, and Transform, and false for purely Readable streams or non-streams","isStream.duplex returns true for streams that are both readable and writable such as Duplex and Transform, and false for purely Readable or Writable streams","isStream.transform returns true for Transform and PassThrough streams, and false for standard Duplex, Readable, or Writable streams"],"goal":"verify isStream detects Node.js stream instances and differentiate readable writable duplex and transform streams","kind":"HOW","packages":["pkg:npm/is-stream@2.0.1"],"schemaVersion":1,"symbols":["isStream","isStream.duplex","isStream.readable","isStream.transform","isStream.writable"]},"contractCommand":["node","test/contract.js"],"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/is-stream@2.0.1"],"schemaVersion":1,"subject":"pkg:npm/is-stream@2.0.1","symbols":["isStream","isStream.duplex","isStream.readable","isStream.transform","isStream.writable"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-is-stream",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-is-stream",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"is-stream": "2.0.1"
}
},
"node_modules/is-stream": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
"license": "MIT",
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
}
}
}
{
"name": "sample-is-stream",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for is-stream",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"is-stream": "2.0.1"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify isStream detects Node.js stream instances and differentiate readable writable duplex and transform streams",
"kind": "HOW",
"packages": [
"pkg:npm/is-stream@2.0.1"
],
"symbols": [
"isStream",
"isStream.duplex",
"isStream.readable",
"isStream.transform",
"isStream.writable"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
'use strict';
const isStream = require('is-stream');
function inspectStream(value) {
return {
isStream: isStream(value),
isReadable: isStream.readable(value),
isWritable: isStream.writable(value),
isDuplex: isStream.duplex(value),
isTransform: isStream.transform(value)
};
}
module.exports = {
inspectStream
};
'use strict';
const assert = require('node:assert');
const { Stream, Readable, Writable, Duplex, Transform, PassThrough } = require('node:stream');
const isStream = require('is-stream');
const { inspectStream } = require('../src/index.js');
// 1. isStream: returns true for Stream instances and pipe-capable objects, false for primitives and plain objects
assert.strictEqual(isStream(new Stream()), true, 'Stream base instance should be a stream');
assert.strictEqual(isStream(new Readable({ read() {} })), true, 'Readable should be a stream');
assert.strictEqual(isStream(new Writable({ write(c, e, cb) { cb(); } })), true, 'Writable should be a stream');
assert.strictEqual(isStream(new Duplex({ read() {}, write(c, e, cb) { cb(); } })), true, 'Duplex should be a stream');
assert.strictEqual(isStream(new Transform({ transform(c, e, cb) { cb(null, c); } })), true, 'Transform should be a stream');
assert.strictEqual(isStream(new PassThrough()), true, 'PassThrough should be a stream');
assert.strictEqual(isStream({ pipe: () => {} }), true, 'Object with pipe method should be considered a stream');
assert.strictEqual(isStream(null), false, 'null is not a stream');
assert.strictEqual(isStream(undefined), false, 'undefined is not a stream');
assert.strictEqual(isStream(123), false, 'number is not a stream');
assert.strictEqual(isStream('hello'), false, 'string is not a stream');
assert.strictEqual(isStream(true), false, 'boolean is not a stream');
assert.strictEqual(isStream({}), false, 'plain object is not a stream');
assert.strictEqual(isStream([]), false, 'array is not a stream');
assert.strictEqual(isStream(() => {}), false, 'function is not a stream');
// 2. isStream.readable: true for Readable, Duplex, Transform, false for purely Writable or non-streams
const readable = new Readable({ read() {} });
const writable = new Writable({ write(c, e, cb) { cb(); } });
const duplex = new Duplex({ read() {}, write(c, e, cb) { cb(); } });
const transform = new Transform({ transform(c, e, cb) { cb(null, c); } });
const passThrough = new PassThrough();
assert.strictEqual(isStream.readable(readable), true, 'Readable should be readable');
assert.strictEqual(isStream.readable(duplex), true, 'Duplex should be readable');
assert.strictEqual(isStream.readable(transform), true, 'Transform should be readable');
assert.strictEqual(isStream.readable(passThrough), true, 'PassThrough should be readable');
assert.strictEqual(isStream.readable(writable), false, 'Writable should not be readable');
assert.strictEqual(isStream.readable(new Stream()), false, 'Raw Stream base should not be readable');
assert.strictEqual(isStream.readable({}), false, 'plain object should not be readable');
// 3. isStream.writable: true for Writable, Duplex, Transform, false for purely Readable or non-streams
assert.strictEqual(isStream.writable(writable), true, 'Writable should be writable');
assert.strictEqual(isStream.writable(duplex), true, 'Duplex should be writable');
assert.strictEqual(isStream.writable(transform), true, 'Transform should be writable');
assert.strictEqual(isStream.writable(passThrough), true, 'PassThrough should be writable');
assert.strictEqual(isStream.writable(readable), false, 'Readable should not be writable');
assert.strictEqual(isStream.writable(new Stream()), false, 'Raw Stream base should not be writable');
assert.strictEqual(isStream.writable({}), false, 'plain object should not be writable');
// 4. isStream.duplex: true for Duplex and Transform, false for purely Readable or Writable
assert.strictEqual(isStream.duplex(duplex), true, 'Duplex should be duplex');
assert.strictEqual(isStream.duplex(transform), true, 'Transform should be duplex');
assert.strictEqual(isStream.duplex(passThrough), true, 'PassThrough should be duplex');
assert.strictEqual(isStream.duplex(readable), false, 'Readable should not be duplex');
assert.strictEqual(isStream.duplex(writable), false, 'Writable should not be duplex');
// 5. isStream.transform: true for Transform and PassThrough, false for standard Duplex, Readable, Writable
assert.strictEqual(isStream.transform(transform), true, 'Transform should be transform');
assert.strictEqual(isStream.transform(passThrough), true, 'PassThrough should be transform');
assert.strictEqual(isStream.transform(duplex), false, 'Standard Duplex should not be transform');
assert.strictEqual(isStream.transform(readable), false, 'Readable should not be transform');
assert.strictEqual(isStream.transform(writable), false, 'Writable should not be transform');
// 6. inspectStream helper verification
assert.deepStrictEqual(inspectStream(transform), {
isStream: true,
isReadable: true,
isWritable: true,
isDuplex: true,
isTransform: true
});
assert.deepStrictEqual(inspectStream(readable), {
isStream: true,
isReadable: true,
isWritable: false,
isDuplex: false,
isTransform: false
});
assert.deepStrictEqual(inspectStream(writable), {
isStream: true,
isReadable: false,
isWritable: true,
isDuplex: false,
isTransform: false
});
console.log('Contract tests passed successfully.');
오리진 시더
익명