Exemplo
read-binary-file-arch 1.0.6: readBinaryFileArch
Amostra verificada para npm read-binary-file-arch 1.0.6: readBinaryFileArch. O contrato rodou em node 22 · linux debian/x64 · docker e passou.
sha256:73ed359a17b0e4fdb833fb4988a4788a73e3e75677c9130b438b468640979599
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 npm
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify read-binary-file-arch.readBinaryFileArch in pkg:npm/read-binary-file-arch@1.0.6
- Pacotes
- Símbolos
-
- read-binary-file-arch.readBinaryFileArch
- Criado
- 2026-09-06T09:43:15Z
Contrato
- 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
Arquivos
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código-fonte
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 });
}
Seeder de origem
anônimo