샘플
iconv-lite 0.6.3
검증된 샘플 — npm iconv-lite 0.6.3. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: assert encoding existence checks return true for supported legacy…
sha256:f60f315dc0de02e8a7114f0760fabd8c5bafaa9d10a90a30a020b2d7a02fd37b
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 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-24 |
케이스
HOW- 목표
- verify pkg:npm/iconv-lite@0.6.3
- 패키지
- 환경
- node 22.23.2
- 생성일
- 2026-08-24T20:22:07Z
컨트랙트
- assert encoding existence checks return true for supported legacy encodings and false for unknown encodings
- assert Korean EUC-KR encoding and decoding roundtrip preserves original text and produces valid byte buffer
- assert Japanese Shift_JIS encoding and decoding roundtrip preserves original multibyte text
- assert Cyrillic Windows-1251 encoding and decoding roundtrip preserves original text accurately
- assert UTF-8 encoding with addBOM prepends byte order mark 0xEF 0xBB 0xBF and default decoding strips BOM while explicit option retains BOM
- assert stateful chunked decoder correctly decodes multibyte character stream split across chunk boundaries
파일
- PROMPT.md
- csx.json
- index.js
- 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 pkg:npm/iconv-lite@0.6.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/iconv-lite@0.6.3
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:a2785b19ff6ed21b3fa8fa700c3bd4a33062c2851b6d6b94a2b74af8d92c83f5","constraints":{"executionContext":"node"},"contract":["assert encoding existence checks return true for supported legacy encodings and false for unknown encodings","assert Korean EUC-KR encoding and decoding roundtrip preserves original text and produces valid byte buffer","assert Japanese Shift_JIS encoding and decoding roundtrip preserves original multibyte text","assert Cyrillic Windows-1251 encoding and decoding roundtrip preserves original text accurately","assert UTF-8 encoding with addBOM prepends byte order mark 0xEF 0xBB 0xBF and default decoding strips BOM while explicit option retains BOM","assert stateful chunked decoder correctly decodes multibyte character stream split across chunk boundaries"],"goal":"verify pkg:npm/iconv-lite@0.6.3","kind":"HOW","packages":["pkg:npm/iconv-lite@0.6.3"],"schemaVersion":1},"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/iconv-lite@0.6.3"],"schemaVersion":1,"subject":"pkg:npm/iconv-lite@0.6.3","verifierAdapter":"node-typescript@1"}
const iconv = require('iconv-lite');
function convertEncoding(text, fromEncoding, toEncoding) {
const buf = iconv.encode(text, fromEncoding);
return iconv.decode(buf, toEncoding);
}
function encodeToBuffer(text, encoding, options) {
return iconv.encode(text, encoding, options);
}
function decodeFromBuffer(buf, encoding, options) {
return iconv.decode(buf, encoding, options);
}
function isEncodingSupported(encoding) {
return iconv.encodingExists(encoding);
}
function createChunkedDecoder(encoding, options) {
return iconv.getDecoder(encoding, options);
}
function createChunkedEncoder(encoding, options) {
return iconv.getEncoder(encoding, options);
}
module.exports = {
convertEncoding,
encodeToBuffer,
decodeFromBuffer,
isEncodingSupported,
createChunkedDecoder,
createChunkedEncoder,
iconv,
};
{
"name": "sample-iconv-lite",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-iconv-lite",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"iconv-lite": "0.6.3"
}
},
"node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"license": "MIT"
}
}
}
{
"name": "sample-iconv-lite",
"version": "1.0.0",
"description": "Minimal clean-room sample verifying iconv-lite character encoding conversions",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"iconv-lite": "0.6.3"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/iconv-lite@0.6.3",
"kind": "HOW",
"packages": [
"pkg:npm/iconv-lite@0.6.3"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert';
import iconv from 'iconv-lite';
import {
convertEncoding,
encodeToBuffer,
decodeFromBuffer,
isEncodingSupported,
createChunkedDecoder,
} from '../index.js';
// 1. Encoding existence checks
assert.strictEqual(isEncodingSupported('utf-8'), true, 'UTF-8 must be supported');
assert.strictEqual(isEncodingSupported('windows-1252'), true, 'Windows-1252 must be supported');
assert.strictEqual(isEncodingSupported('euc-kr'), true, 'EUC-KR must be supported');
assert.strictEqual(isEncodingSupported('shift_jis'), true, 'Shift_JIS must be supported');
assert.strictEqual(isEncodingSupported('win1251'), true, 'Windows-1251 must be supported');
assert.strictEqual(isEncodingSupported('unknown-encoding-xyz-12345'), false, 'Unknown encoding must return false');
// 2. Korean EUC-KR encode/decode roundtrip
const koreanText = '안녕하세요 세계';
const eucKrBuf = encodeToBuffer(koreanText, 'euc-kr');
assert(Buffer.isBuffer(eucKrBuf), 'encodeToBuffer must return a Buffer');
const decodedKorean = decodeFromBuffer(eucKrBuf, 'euc-kr');
assert.strictEqual(decodedKorean, koreanText, 'EUC-KR roundtrip decode must match original');
// 3. Japanese Shift_JIS encode/decode roundtrip
const japaneseText = 'こんにちは世界';
const shiftJisBuf = encodeToBuffer(japaneseText, 'shift_jis');
const decodedJapanese = decodeFromBuffer(shiftJisBuf, 'shift_jis');
assert.strictEqual(decodedJapanese, japaneseText, 'Shift_JIS roundtrip decode must match original');
// 4. Cyrillic Windows-1251 encode/decode roundtrip
const cyrillicText = 'Привет мир';
const win1251Buf = encodeToBuffer(cyrillicText, 'windows-1251');
const decodedCyrillic = decodeFromBuffer(win1251Buf, 'windows-1251');
assert.strictEqual(decodedCyrillic, cyrillicText, 'Windows-1251 roundtrip decode must match original');
// 5. UTF-8 BOM handling
const asciiText = 'Hello World';
const withBOM = encodeToBuffer(asciiText, 'utf-8', { addBOM: true });
assert.strictEqual(withBOM[0], 0xef, 'First byte of UTF-8 BOM must be 0xEF');
assert.strictEqual(withBOM[1], 0xbb, 'Second byte of UTF-8 BOM must be 0xBB');
assert.strictEqual(withBOM[2], 0xbf, 'Third byte of UTF-8 BOM must be 0xBF');
const strippedBOM = decodeFromBuffer(withBOM, 'utf-8');
assert.strictEqual(strippedBOM, asciiText, 'decode must strip BOM by default');
const retainedBOM = decodeFromBuffer(withBOM, 'utf-8', { stripBOM: false });
assert.strictEqual(retainedBOM.charCodeAt(0), 0xfeff, 'decode with stripBOM: false must retain BOM');
// 6. Stateful / Chunked decoding across byte boundaries
const decoder = createChunkedDecoder('utf-8');
const partial1 = Buffer.from([0xec, 0x95]);
const partial2 = Buffer.from([0x88, 0xeb, 0x85, 0x95]);
const chunk1 = decoder.write(partial1);
const chunk2 = decoder.write(partial2);
const finalChunk = decoder.end() || '';
const streamResult = (chunk1 || '') + (chunk2 || '') + finalChunk;
assert.strictEqual(streamResult, '안녕', 'Chunked decoding across multibyte split must reconstruct characters accurately');
console.log('All contract assertions passed.');
오리진 시더
익명