샘플
basic-ftp 5.3.1: FileType
검증된 샘플 — npm basic-ftp 5.3.1: FileType. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: FileType enumeration defines integer constants for…
sha256:adf11c8bdb651480a47130e90c3ec0c3c123445db823d7b8dcc20ef3a870d00a
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 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@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-07 |
케이스
HOW- 목표
- verify basic-ftp.FileType in pkg:npm/basic-ftp@5.3.1
- 패키지
- 심벌
-
- basic-ftp.FileType
- 생성일
- 2026-08-26T12:28:39Z
컨트랙트
- FileType enumeration defines integer constants for Unknown (0), File (1), Directory (2), and SymbolicLink (3)
- FileType provides reverse mapping from numeric values to type name strings
- FileInfo instances use FileType values to determine isFile, isDirectory, and isSymbolicLink boolean states
- parseList parses directory listings and populates FileInfo objects with the corresponding FileType enum values
파일
- 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 basic-ftp.FileType in pkg:npm/basic-ftp@5.3.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/basic-ftp@5.3.1
Demonstrate these symbols/APIs:
- basic-ftp.FileType
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:8f0ed1c8f160292da49feeac3d5027a9a7898037c4665aa81240432d0d24462f","contract":["FileType enumeration defines integer constants for Unknown (0), File (1), Directory (2), and SymbolicLink (3)","FileType provides reverse mapping from numeric values to type name strings","FileInfo instances use FileType values to determine isFile, isDirectory, and isSymbolicLink boolean states","parseList parses directory listings and populates FileInfo objects with the corresponding FileType enum values"],"goal":"verify basic-ftp.FileType in pkg:npm/basic-ftp@5.3.1","kind":"HOW","packages":["pkg:npm/basic-ftp@5.3.1"],"schemaVersion":1,"symbols":["basic-ftp.FileType"]},"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/basic-ftp@5.3.1"],"schemaVersion":1,"subject":"pkg:npm/basic-ftp@5.3.1","symbols":["basic-ftp.FileType"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-basic-ftp-filetype",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-basic-ftp-filetype",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"basic-ftp": "5.3.1"
}
},
"node_modules/basic-ftp": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.3.1.tgz",
"integrity": "sha512-bopVNp6ugyA150DDuZfPFdt1KZ5a94ZDiwX4hMgZDzF+GttD80lEy8kj98kbyhLXnPvhtIo93mdnLIjpCAeeOw==",
"license": "MIT",
"engines": {
"node": ">=10.0.0"
}
}
}
}
{
"name": "sample-basic-ftp-filetype",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"basic-ftp": "5.3.1"
}
}
{
"schemaVersion": 1,
"goal": "verify basic-ftp.FileType in pkg:npm/basic-ftp@5.3.1",
"kind": "HOW",
"packages": [
"pkg:npm/basic-ftp@5.3.1"
],
"symbols": [
"basic-ftp.FileType"
]
}
import ftp from 'basic-ftp';
const { FileType, FileInfo, parseList } = ftp;
/**
* Resolves the string name for a given FileType enum value.
* @param {number} fileType - The numeric FileType value.
* @returns {string} The name of the file type.
*/
export function getFileTypeName(fileType) {
return FileType[fileType] || 'Unknown';
}
/**
* Creates a FileInfo instance with a specified name and FileType.
* @param {string} name - File or directory name.
* @param {number} type - FileType enum value.
* @returns {ftp.FileInfo} Configured FileInfo object.
*/
export function createFileInfo(name, type) {
const info = new FileInfo(name);
info.type = type;
return info;
}
/**
* Parses raw FTP list output into FileInfo objects with FileType information.
* @param {string} rawEntries - Raw directory listing string.
* @returns {ftp.FileInfo[]} Array of parsed FileInfo objects.
*/
export function parseDirectoryList(rawEntries) {
return parseList(rawEntries);
}
export { FileType, FileInfo, parseList };
export default FileType;
import assert from 'node:assert/strict';
import ftp from 'basic-ftp';
import {
FileType,
FileInfo,
parseList,
getFileTypeName,
createFileInfo,
parseDirectoryList
} from '../src/index.mjs';
// 1. FileType enumeration defines integer constants for Unknown (0), File (1), Directory (2), and SymbolicLink (3)
{
assert.equal(FileType.Unknown, 0);
assert.equal(FileType.File, 1);
assert.equal(FileType.Directory, 2);
assert.equal(FileType.SymbolicLink, 3);
}
// 2. FileType provides reverse mapping from numeric values to type name strings
{
assert.equal(FileType[0], 'Unknown');
assert.equal(FileType[1], 'File');
assert.equal(FileType[2], 'Directory');
assert.equal(FileType[3], 'SymbolicLink');
assert.equal(getFileTypeName(FileType.Unknown), 'Unknown');
assert.equal(getFileTypeName(FileType.File), 'File');
assert.equal(getFileTypeName(FileType.Directory), 'Directory');
assert.equal(getFileTypeName(FileType.SymbolicLink), 'SymbolicLink');
}
// 3. FileInfo instances use FileType values to determine isFile, isDirectory, and isSymbolicLink boolean states
{
const file = createFileInfo('example.txt', FileType.File);
assert.equal(file.name, 'example.txt');
assert.equal(file.type, FileType.File);
assert.equal(file.isFile, true);
assert.equal(file.isDirectory, false);
assert.equal(file.isSymbolicLink, false);
const dir = createFileInfo('docs', FileType.Directory);
assert.equal(dir.name, 'docs');
assert.equal(dir.type, FileType.Directory);
assert.equal(dir.isFile, false);
assert.equal(dir.isDirectory, true);
assert.equal(dir.isSymbolicLink, false);
const link = createFileInfo('link-to-doc', FileType.SymbolicLink);
assert.equal(link.name, 'link-to-doc');
assert.equal(link.type, FileType.SymbolicLink);
assert.equal(link.isFile, false);
assert.equal(link.isDirectory, false);
assert.equal(link.isSymbolicLink, true);
const unknown = createFileInfo('unknown-entry', FileType.Unknown);
assert.equal(unknown.type, FileType.Unknown);
assert.equal(unknown.isFile, false);
assert.equal(unknown.isDirectory, false);
assert.equal(unknown.isSymbolicLink, false);
}
// 4. parseList parses directory listings and populates FileInfo objects with the corresponding FileType enum values
{
const rawList = [
'-rw-r--r-- 1 owner group 1024 Jan 01 00:00 notes.txt',
'drwxr-xr-x 2 owner group 4096 Jan 01 00:00 projects',
'lrwxrwxrwx 1 owner group 9 Jan 01 00:00 shortcut -> notes.txt'
].join('\n');
const parsed = parseDirectoryList(rawList);
assert.equal(parsed.length, 3);
assert.equal(parsed[0].name, 'notes.txt');
assert.equal(parsed[0].type, FileType.File);
assert.equal(parsed[0].isFile, true);
assert.equal(parsed[1].name, 'projects');
assert.equal(parsed[1].type, FileType.Directory);
assert.equal(parsed[1].isDirectory, true);
assert.equal(parsed[2].name, 'shortcut');
assert.equal(parsed[2].type, FileType.SymbolicLink);
assert.equal(parsed[2].isSymbolicLink, true);
}
console.log('Contract tests passed successfully.');
오리진 시더
익명