샘플
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
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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);
}
오리진 시더
익명