샘플
fs-extra 11.3.1
검증된 샘플 — npm fs-extra 11.3.1. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: ensureDir creates nested directory structures if they do not exist
sha256:aa7391eac1a723861f5805a30a82ac2822dd03a8ce37cf9e0be5537fc06ad5b6
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript 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-20 |
케이스
HOW- 목표
- verify pkg:npm/fs-extra@11.3.1
- 패키지
- 환경
- node 22.23.2
- 생성일
- 2026-08-20T20:14:57Z
컨트랙트
- ensureDir creates nested directory structures if they do not exist
- outputJson and readJson write and read JSON documents while automatically creating parent directories
- outputFile writes string data creating parent directories automatically and readFile retrieves the written content
- copy recursively copies directory hierarchies and supports custom filter functions
- emptyDir deletes all contents within a directory while leaving the directory itself intact
- pathExists accurately checks the existence of files and directories
- remove recursively removes directories and files without throwing if the target does not exist
- move moves files and directories across paths with optional overwrite
- ensureFile creates parent directories and an empty file if the file does not exist
파일
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
소스
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/fs-extra@11.3.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/fs-extra@11.3.1
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- 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:a008f65cca884fbd05cb32b7c3ab73000db062e2a96192d0531b87efbbce7541","constraints":{"executionContext":"node"},"contract":["ensureDir creates nested directory structures if they do not exist","outputJson and readJson write and read JSON documents while automatically creating parent directories","outputFile writes string data creating parent directories automatically and readFile retrieves the written content","copy recursively copies directory hierarchies and supports custom filter functions","emptyDir deletes all contents within a directory while leaving the directory itself intact","pathExists accurately checks the existence of files and directories","remove recursively removes directories and files without throwing if the target does not exist","move moves files and directories across paths with optional overwrite","ensureFile creates parent directories and an empty file if the file does not exist"],"goal":"verify pkg:npm/fs-extra@11.3.1","kind":"HOW","packages":["pkg:npm/fs-extra@11.3.1"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/fs-extra@11.3.1"],"schemaVersion":1,"subject":"pkg:npm/fs-extra@11.3.1","verifierAdapter":"node-typescript@1"}
const fs = require('fs-extra');
module.exports = {
fs
};
{
"name": "sample-fs-extra",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-fs-extra",
"version": "1.0.0",
"dependencies": {
"fs-extra": "11.3.1"
}
},
"node_modules/fs-extra": {
"version": "11.3.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.1.tgz",
"integrity": "sha512-eXvGGwZ5CL17ZSwHWd3bbgk7UUpF6IFHtP57NYYakPvHOs8GDgDe5KJI36jIJzDkJ6eJjuzRA8eBQb6SkKue0g==",
"license": "MIT",
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
},
"engines": {
"node": ">=14.14"
}
},
"node_modules/graceful-fs": {
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
"license": "ISC"
},
"node_modules/jsonfile": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz",
"integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==",
"license": "MIT",
"dependencies": {
"universalify": "^2.0.0"
},
"optionalDependencies": {
"graceful-fs": "^4.1.6"
}
},
"node_modules/universalify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
"integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
"license": "MIT",
"engines": {
"node": ">= 10.0.0"
}
}
}
}
{
"name": "sample-fs-extra",
"version": "1.0.0",
"private": true,
"description": "Clean-room code sample for fs-extra@11.3.1",
"main": "index.js",
"dependencies": {
"fs-extra": "11.3.1"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/fs-extra@11.3.1",
"kind": "HOW",
"packages": [
"pkg:npm/fs-extra@11.3.1"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"runtime": "node@22.23.2"
}
}
const assert = require('node:assert/strict');
const path = require('node:path');
const os = require('node:os');
const fs = require('fs-extra');
async function run() {
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'fs-extra-test-'));
try {
// 1. ensureDir creates nested directory structures if they do not exist
const nestedDir = path.join(tmpDir, 'nested', 'a', 'b', 'c');
await fs.ensureDir(nestedDir);
const dirStat = await fs.stat(nestedDir);
assert.equal(dirStat.isDirectory(), true);
// 2. outputJson and readJson write and read JSON documents while automatically creating parent directories
const jsonPath = path.join(tmpDir, 'json', 'data.json');
const testData = { name: 'codesamplex', version: '1.0.0', active: true };
await fs.outputJson(jsonPath, testData);
const readData = await fs.readJson(jsonPath);
assert.deepEqual(readData, testData);
// 3. outputFile writes string data creating parent directories automatically and readFile retrieves the written content
const filePath = path.join(tmpDir, 'files', 'hello.txt');
await fs.outputFile(filePath, 'Hello, fs-extra!');
const content = await fs.readFile(filePath, 'utf8');
assert.equal(content, 'Hello, fs-extra!');
// 4. copy recursively copies directory hierarchies and supports custom filter functions
const srcDir = path.join(tmpDir, 'src_copy');
const destDir = path.join(tmpDir, 'dest_copy');
await fs.outputFile(path.join(srcDir, 'file1.txt'), 'content1');
await fs.outputFile(path.join(srcDir, 'ignore.tmp'), 'ignore');
await fs.copy(srcDir, destDir, {
filter: (src) => !src.endsWith('.tmp')
});
assert.equal(await fs.pathExists(path.join(destDir, 'file1.txt')), true);
assert.equal(await fs.pathExists(path.join(destDir, 'ignore.tmp')), false);
// 5. emptyDir deletes all contents within a directory while leaving the directory itself intact
const emptyTargetDir = path.join(tmpDir, 'to_empty');
await fs.outputFile(path.join(emptyTargetDir, 'temp.txt'), 'data');
await fs.emptyDir(emptyTargetDir);
assert.equal(await fs.pathExists(emptyTargetDir), true);
const items = await fs.readdir(emptyTargetDir);
assert.equal(items.length, 0);
// 6. pathExists accurately checks the existence of files and directories
assert.equal(await fs.pathExists(emptyTargetDir), true);
assert.equal(await fs.pathExists(path.join(tmpDir, 'non_existent')), false);
// 7. remove recursively removes directories and files without throwing if the target does not exist
const removeTarget = path.join(tmpDir, 'to_remove');
await fs.outputFile(path.join(removeTarget, 'child.txt'), 'data');
await fs.remove(removeTarget);
assert.equal(await fs.pathExists(removeTarget), false);
// removing non-existent target should not throw
await fs.remove(path.join(tmpDir, 'does-not-exist'));
// 8. move moves files and directories across paths with optional overwrite
const moveSrc = path.join(tmpDir, 'move_src.txt');
const moveDest = path.join(tmpDir, 'moved', 'move_dest.txt');
await fs.outputFile(moveSrc, 'move content');
await fs.move(moveSrc, moveDest);
assert.equal(await fs.pathExists(moveSrc), false);
assert.equal(await fs.readFile(moveDest, 'utf8'), 'move content');
// 9. ensureFile creates parent directories and an empty file if the file does not exist
const ensureFilePath = path.join(tmpDir, 'nested', 'deep', 'empty.txt');
await fs.ensureFile(ensureFilePath);
assert.equal(await fs.pathExists(ensureFilePath), true);
const emptyStat = await fs.stat(ensureFilePath);
assert.equal(emptyStat.isFile(), true);
assert.equal(emptyStat.size, 0);
console.log('All fs-extra assertions passed.');
} finally {
await fs.remove(tmpDir);
}
}
run().catch((err) => {
console.error(err);
process.exit(1);
});
오리진 시더
익명