サンプル
png-to-ico 2.1.8
検証済みサンプル — npm png-to-ico 2.1.8. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: pngToIco converts a PNG buffer into a Windows ICO format buffer…
sha256:864a080460dfccb4350e1972e33bc5c8fd41671d8cffaa4f4b303d8b0661773e
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux 24 · ubuntu · glibc 2.39 x64 npm
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-21 |
ケース
HOW- ゴール
- verify pkg:npm/png-to-ico@2.1.8
- パッケージ
- 作成日
- 2026-08-21T14:42:35Z
コントラクト
- pngToIco converts a PNG buffer into a Windows ICO format buffer with valid headers
- pngToIco converts a PNG image file path into a Windows ICO format buffer
- pngToIco converts an array of PNG images into a multi-resolution Windows ICO buffer
- pngToIco rejects with an error when given invalid image data or a non-existent file path
ファイル
- 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/png-to-ico@2.1.8
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/png-to-ico@2.1.8
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:18bf6d5517fb784fb95588c3e9545178576d6241ffb11fa862d18b1a52bc725b","contract":["pngToIco converts a PNG buffer into a Windows ICO format buffer with valid headers","pngToIco converts a PNG image file path into a Windows ICO format buffer","pngToIco converts an array of PNG images into a multi-resolution Windows ICO buffer","pngToIco rejects with an error when given invalid image data or a non-existent file path"],"goal":"verify pkg:npm/png-to-ico@2.1.8","kind":"HOW","packages":["pkg:npm/png-to-ico@2.1.8"],"schemaVersion":1},"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/png-to-ico@2.1.8"],"schemaVersion":1,"subject":"pkg:npm/png-to-ico@2.1.8","verifierAdapter":"node-typescript@1"}
{
"name": "verify-png-to-ico",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "verify-png-to-ico",
"version": "1.0.0",
"dependencies": {
"png-to-ico": "2.1.8"
}
},
"node_modules/@types/node": {
"version": "17.0.45",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz",
"integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==",
"license": "MIT"
},
"node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/png-to-ico": {
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/png-to-ico/-/png-to-ico-2.1.8.tgz",
"integrity": "sha512-Nf+IIn/cZ/DIZVdGveJp86NG5uNib1ZXMiDd/8x32HCTeKSvgpyg6D/6tUBn1QO/zybzoMK0/mc3QRgAyXdv9w==",
"license": "MIT",
"dependencies": {
"@types/node": "^17.0.36",
"minimist": "^1.2.6",
"pngjs": "^6.0.0"
},
"bin": {
"png-to-ico": "bin/cli.js"
},
"engines": {
"node": ">=8"
}
},
"node_modules/pngjs": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz",
"integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==",
"license": "MIT",
"engines": {
"node": ">=12.13.0"
}
}
}
}
{
"name": "verify-png-to-ico",
"version": "1.0.0",
"type": "module",
"dependencies": {
"png-to-ico": "2.1.8"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/png-to-ico@2.1.8",
"kind": "HOW",
"packages": [
"pkg:npm/png-to-ico@2.1.8"
]
}
import pngToIco from 'png-to-ico';
export async function convertPngToIco(input) {
return await pngToIco(input);
}
export default pngToIco;
import assert from 'node:assert';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import pngToIco, { convertPngToIco } from '../src/index.mjs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// 16x16 PNG and 32x32 PNG fixtures encoded as base64
const PNG_16X16_BASE64 = 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAALklEQVR4AaXBAQEAMAiAMCTZo725hmCb/W8JJJJIIokkkkgiiSSSSCKJJJJIogNi2gLene9JPAAAAABJRU5ErkJggg==';
const PNG_32X32_BASE64 = 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAARklEQVR4AcXBAQEAMAiAMCTZo725xmCb/W8JSUxiEpOYxCQmMYlJTGISk5jEJCYxiUlMYhKTmMQkJjGJSUxiEpOYxCQmsQNH1wL+DE99BwAAAABJRU5ErkJggg==';
const png1 = Buffer.from(PNG_16X16_BASE64, 'base64');
const png2 = Buffer.from(PNG_32X32_BASE64, 'base64');
const fixtureDir = path.join(__dirname, 'fixtures');
const file1 = path.join(fixtureDir, 'icon1.png');
const file2 = path.join(fixtureDir, 'icon2.png');
if (!fs.existsSync(fixtureDir)) {
fs.mkdirSync(fixtureDir, { recursive: true });
}
fs.writeFileSync(file1, png1);
fs.writeFileSync(file2, png2);
try {
// 1. Convert PNG buffer into Windows ICO format buffer
const icoFromBuffer = await convertPngToIco(png1);
assert.ok(Buffer.isBuffer(icoFromBuffer), 'Output must be a Buffer');
assert.strictEqual(icoFromBuffer.readUInt16LE(0), 0, 'ICO header reserved must be 0');
assert.strictEqual(icoFromBuffer.readUInt16LE(2), 1, 'ICO header type must be 1 (icon)');
assert.ok(icoFromBuffer.readUInt16LE(4) >= 1, 'ICO image count must be at least 1');
// 2. Convert PNG image file path into Windows ICO format buffer
const icoFromFile = await pngToIco(file1);
assert.ok(Buffer.isBuffer(icoFromFile), 'Output must be a Buffer');
assert.strictEqual(icoFromFile.readUInt16LE(0), 0, 'ICO header reserved must be 0');
assert.strictEqual(icoFromFile.readUInt16LE(2), 1, 'ICO header type must be 1 (icon)');
assert.ok(icoFromFile.readUInt16LE(4) >= 1, 'ICO image count must be at least 1');
// 3. Convert an array of PNG images into a multi-resolution Windows ICO buffer
const icoFromArray = await pngToIco([file1, file2]);
assert.ok(Buffer.isBuffer(icoFromArray), 'Output must be a Buffer');
assert.strictEqual(icoFromArray.readUInt16LE(0), 0, 'ICO header reserved must be 0');
assert.strictEqual(icoFromArray.readUInt16LE(2), 1, 'ICO header type must be 1 (icon)');
assert.strictEqual(icoFromArray.readUInt16LE(4), 2, 'ICO image count must be 2 for 2 input files');
// 4. Rejection when given invalid image data or a non-existent file path
await assert.rejects(
async () => {
await pngToIco(Buffer.from('corrupted-image-data-not-a-png'));
},
(err) => {
assert.ok(err instanceof Error, 'Expected rejection with Error on invalid buffer');
return true;
}
);
await assert.rejects(
async () => {
await pngToIco(path.join(fixtureDir, 'non-existent-image.png'));
},
(err) => {
assert.ok(err instanceof Error, 'Expected rejection with Error on non-existent file');
return true;
}
);
console.log('Contract tests passed successfully.');
} finally {
if (fs.existsSync(file1)) fs.unlinkSync(file1);
if (fs.existsSync(file2)) fs.unlinkSync(file2);
if (fs.existsSync(fixtureDir)) fs.rmdirSync(fixtureDir);
}
オリジンシーダー
匿名