샘플
read-binary-file-arch 1.0.6: readBinaryFileArch
검증된 샘플 — npm read-binary-file-arch 1.0.6: readBinaryFileArch. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: readBinaryFileArch detects x64…
sha256:73ed359a17b0e4fdb833fb4988a4788a73e3e75677c9130b438b468640979599
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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-06 |
케이스
HOW- 목표
- verify read-binary-file-arch.readBinaryFileArch in pkg:npm/read-binary-file-arch@1.0.6
- 심벌
-
- read-binary-file-arch.readBinaryFileArch
- 생성일
- 2026-09-06T09:43:15Z
컨트랙트
- readBinaryFileArch detects x64 architecture for Node.js executable binary
- readBinaryFileArch identifies x64 architecture from synthetic PE binary header
- readBinaryFileArch identifies ia32 architecture from synthetic PE binary header
- readBinaryFileArch returns null for non-binary plain text files
- readBinaryFileArch rejects directory paths with an error indicating target is not a file
- readBinaryFileArch rejects non-existent file paths with ENOENT error
파일
- PROMPT.md
- csx.json
- index.mjs
- 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 read-binary-file-arch.readBinaryFileArch in pkg:npm/read-binary-file-arch@1.0.6
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/read-binary-file-arch@1.0.6
Demonstrate these symbols/APIs:
- read-binary-file-arch.readBinaryFileArch
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:9f49fa3325d0ead5083d7fd0df57de16d5e83552e549b7200aede06900869929","contract":["readBinaryFileArch detects x64 architecture for Node.js executable binary","readBinaryFileArch identifies x64 architecture from synthetic PE binary header","readBinaryFileArch identifies ia32 architecture from synthetic PE binary header","readBinaryFileArch returns null for non-binary plain text files","readBinaryFileArch rejects directory paths with an error indicating target is not a file","readBinaryFileArch rejects non-existent file paths with ENOENT error"],"goal":"verify read-binary-file-arch.readBinaryFileArch in pkg:npm/read-binary-file-arch@1.0.6","kind":"HOW","packages":["pkg:npm/read-binary-file-arch@1.0.6"],"schemaVersion":1,"symbols":["read-binary-file-arch.readBinaryFileArch"]},"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/read-binary-file-arch@1.0.6"],"schemaVersion":1,"subject":"pkg:npm/read-binary-file-arch@1.0.6","symbols":["read-binary-file-arch.readBinaryFileArch"],"verifierAdapter":"node-typescript@1"}
import { readBinaryFileArch } from 'read-binary-file-arch';
export { readBinaryFileArch };
export async function detectBinaryArch(filePath) {
return readBinaryFileArch(filePath);
}
{
"name": "sample-read-binary-file-arch",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-read-binary-file-arch",
"version": "1.0.0",
"dependencies": {
"read-binary-file-arch": "1.0.6"
}
},
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/read-binary-file-arch": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/read-binary-file-arch/-/read-binary-file-arch-1.0.6.tgz",
"integrity": "sha512-BNg9EN3DD3GsDXX7Aa8O4p92sryjkmzYYgmgTAc6CA4uGLEDzFfxOxugu21akOxpcXHiEgsYkC6nPsQvLLLmEg==",
"license": "MIT",
"dependencies": {
"debug": "^4.3.4"
},
"bin": {
"read-binary-file-arch": "cli.js"
}
}
}
}
{
"name": "sample-read-binary-file-arch",
"version": "1.0.0",
"type": "module",
"main": "index.mjs",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"read-binary-file-arch": "1.0.6"
}
}
{
"schemaVersion": 1,
"goal": "verify read-binary-file-arch.readBinaryFileArch in pkg:npm/read-binary-file-arch@1.0.6",
"kind": "HOW",
"packages": [
"pkg:npm/read-binary-file-arch@1.0.6"
],
"symbols": [
"read-binary-file-arch.readBinaryFileArch"
]
}
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import { readBinaryFileArch } from 'read-binary-file-arch';
import { detectBinaryArch } from '../index.mjs';
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'csx-contract-'));
try {
function createSyntheticPE(machineType) {
const buf = Buffer.alloc(1024);
buf.write('MZ', 0, 'ascii');
buf.writeUInt32LE(0x80, 0x3c);
buf.write('PE\0\0', 0x80, 'ascii');
buf.writeUInt16LE(machineType, 0x84);
return buf;
}
// 1. readBinaryFileArch detects x64 architecture for Node.js executable binary
{
const arch = await readBinaryFileArch(process.execPath);
assert.equal(arch, 'x64');
const helperArch = await detectBinaryArch(process.execPath);
assert.equal(helperArch, 'x64');
}
// 2. readBinaryFileArch identifies x64 architecture from synthetic PE binary header
{
const pePath = path.join(tempDir, 'dummy_x64.exe');
fs.writeFileSync(pePath, createSyntheticPE(0x8664));
const arch = await readBinaryFileArch(pePath);
assert.equal(arch, 'x64');
const helperArch = await detectBinaryArch(pePath);
assert.equal(helperArch, 'x64');
}
// 3. readBinaryFileArch identifies ia32 architecture from synthetic PE binary header
{
const pePath = path.join(tempDir, 'dummy_ia32.exe');
fs.writeFileSync(pePath, createSyntheticPE(0x014c));
const arch = await readBinaryFileArch(pePath);
assert.equal(arch, 'ia32');
const helperArch = await detectBinaryArch(pePath);
assert.equal(helperArch, 'ia32');
}
// 4. readBinaryFileArch returns null for non-binary plain text files
{
const textPath = path.join(tempDir, 'sample.txt');
fs.writeFileSync(textPath, 'This is a plain text file without binary headers.');
const arch = await readBinaryFileArch(textPath);
assert.equal(arch, null);
const helperArch = await detectBinaryArch(textPath);
assert.equal(helperArch, null);
}
// 5. readBinaryFileArch rejects directory paths with an error indicating target is not a file
{
await assert.rejects(
async () => {
await readBinaryFileArch(tempDir);
},
{
name: 'Error',
message: `${tempDir} is not a file.`,
}
);
}
// 6. readBinaryFileArch rejects non-existent file paths with ENOENT error
{
const missingPath = path.join(tempDir, 'missing_file.bin');
await assert.rejects(
async () => {
await readBinaryFileArch(missingPath);
},
(err) => {
assert.equal(err.code, 'ENOENT');
return true;
}
);
}
console.log('All readBinaryFileArch contract assertions passed.');
} finally {
fs.rmSync(tempDir, { recursive: true, force: true });
}
오리진 시더
익명