サンプル
chromium-pickle-js 0.2.0: createEmpty, createFromBuffer
検証済みサンプル — npm chromium-pickle-js 0.2.0: createEmpty, createFromBuffer. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました.
sha256:258c307b68344ed1f201fa4a1d3acd6c6b0dd7ddfdfbafca4e3bbfb2ca0e8951
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
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-26 |
| 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-08 |
ケース
HOW- ゴール
- verify pkg:npm/chromium-pickle-js@0.2.0
- パッケージ
- シンボル
-
- createEmpty
- createFromBuffer
- 環境
- node 22.23.2
- 作成日
- 2026-08-26T09:11:46Z
コントラクト
- createEmpty returns a new Pickle instance that can write bool, int, uint32, float, double, and string primitives
- Pickle.toBuffer returns a Buffer containing the 4-byte payload size header followed by 4-byte aligned payload data
- createFromBuffer initializes a Pickle instance from an existing Buffer for reading with PickleIterator
- PickleIterator sequentially reads bool, int, uint32, float, double, and string values in matching write order
- Pickle.writeInt64 and Pickle.writeUInt64 throw TypeError in Node.js because 64-bit buffer write methods are undefined on Buffer.prototype
- PickleIterator throws an Error when attempting to read past the payload buffer end
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- 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/chromium-pickle-js@0.2.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/chromium-pickle-js@0.2.0
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:2a8593e5836b43efa8f92fa1b859ef2940f790b35ad5147c877cd3218bee6c31","constraints":{"executionContext":"node"},"contract":["createEmpty returns a new Pickle instance that can write bool, int, uint32, float, double, and string primitives","Pickle.toBuffer returns a Buffer containing the 4-byte payload size header followed by 4-byte aligned payload data","createFromBuffer initializes a Pickle instance from an existing Buffer for reading with PickleIterator","PickleIterator sequentially reads bool, int, uint32, float, double, and string values in matching write order","Pickle.writeInt64 and Pickle.writeUInt64 throw TypeError in Node.js because 64-bit buffer write methods are undefined on Buffer.prototype","PickleIterator throws an Error when attempting to read past the payload buffer end"],"goal":"verify pkg:npm/chromium-pickle-js@0.2.0","kind":"HOW","packages":["pkg:npm/chromium-pickle-js@0.2.0"],"schemaVersion":1,"symbols":["createEmpty","createFromBuffer"]},"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/chromium-pickle-js@0.2.0"],"schemaVersion":1,"subject":"pkg:npm/chromium-pickle-js@0.2.0","symbols":["createEmpty","createFromBuffer"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-chromium-pickle-js",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-chromium-pickle-js",
"version": "1.0.0",
"dependencies": {
"chromium-pickle-js": "0.2.0"
}
},
"node_modules/chromium-pickle-js": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz",
"integrity": "sha512-1R5Fho+jBq0DDydt+/vHWj5KJNJCKdARKOCwZUen84I5BreWoLqRLANH1U87eJy1tiASPtMnGqJJq0ZsLoRPOw==",
"license": "MIT"
}
}
}
{
"name": "sample-chromium-pickle-js",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"chromium-pickle-js": "0.2.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/chromium-pickle-js@0.2.0",
"kind": "HOW",
"packages": [
"pkg:npm/chromium-pickle-js@0.2.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import pickle from 'chromium-pickle-js';
const { createEmpty, createFromBuffer } = pickle;
/**
* Creates an empty Pickle instance for writing binary data.
* @returns {object}
*/
export function createEmptyPickle() {
return createEmpty();
}
/**
* Creates a Pickle instance from an existing Buffer for reading.
* @param {Buffer} buffer
* @returns {object}
*/
export function createPickleFromBuffer(buffer) {
return createFromBuffer(buffer);
}
export { createEmpty, createFromBuffer };
import assert from 'node:assert/strict';
import {
createEmpty,
createFromBuffer,
createEmptyPickle,
createPickleFromBuffer,
} from '../src/index.mjs';
// 1. createEmpty returns a new Pickle instance that can write bool, int, uint32, float, double, and string primitives
{
const p = createEmptyPickle();
assert.equal(p.writeBool(true), true);
assert.equal(p.writeBool(false), true);
assert.equal(p.writeInt(-12345), true);
assert.equal(p.writeUInt32(54321), true);
assert.equal(p.writeFloat(1.5), true);
assert.equal(p.writeDouble(3.141592653589793), true);
assert.equal(p.writeString('chromium-pickle-sample'), true);
}
// 2. Pickle.toBuffer returns a Buffer containing the 4-byte payload size header followed by 4-byte aligned payload data
{
const p = createEmpty();
assert.equal(p.writeInt(42), true);
const buf = p.toBuffer();
assert.ok(Buffer.isBuffer(buf));
const payloadSize = buf.readUInt32LE(0);
assert.equal(payloadSize, 4);
assert.equal(buf.length, 8);
assert.equal(buf.readInt32LE(4), 42);
}
// 3. createFromBuffer initializes a Pickle instance from an existing Buffer for reading with PickleIterator
{
const pWrite = createEmpty();
assert.equal(pWrite.writeString('read-test'), true);
const buf = pWrite.toBuffer();
const pRead = createPickleFromBuffer(buf);
const it = pRead.createIterator();
assert.equal(it.readString(), 'read-test');
}
// 4. PickleIterator sequentially reads bool, int, uint32, float, double, and string values in matching write order
{
const p = createEmpty();
assert.equal(p.writeBool(true), true);
assert.equal(p.writeBool(false), true);
assert.equal(p.writeInt(-9876), true);
assert.equal(p.writeUInt32(65432), true);
assert.equal(p.writeFloat(2.5), true);
assert.equal(p.writeDouble(2.718281828459045), true);
assert.equal(p.writeString('sequential-test'), true);
const buf = p.toBuffer();
const pRead = createFromBuffer(buf);
const it = pRead.createIterator();
assert.equal(it.readBool(), true);
assert.equal(it.readBool(), false);
assert.equal(it.readInt(), -9876);
assert.equal(it.readUInt32(), 65432);
assert.equal(it.readFloat(), 2.5);
assert.equal(it.readDouble(), 2.718281828459045);
assert.equal(it.readString(), 'sequential-test');
}
// 5. Pickle.writeInt64 and Pickle.writeUInt64 throw TypeError in Node.js because 64-bit buffer write methods are undefined on Buffer.prototype
{
const p = createEmpty();
assert.throws(
() => {
p.writeInt64(100);
},
{
name: 'TypeError',
}
);
assert.throws(
() => {
p.writeUInt64(100);
},
{
name: 'TypeError',
}
);
}
// 6. PickleIterator throws an Error when attempting to read past the payload buffer end
{
const p = createEmpty();
assert.equal(p.writeInt(100), true);
const buf = p.toBuffer();
const pRead = createFromBuffer(buf);
const it = pRead.createIterator();
assert.equal(it.readInt(), 100);
assert.throws(
() => {
it.readInt();
},
{
name: 'Error',
message: /Failed to read data with length of/,
}
);
}
console.log('Contract assertions passed.');
オリジンシーダー
匿名