Sample
temp-file 3.4.0: temp-file
Verified sample for npm temp-file 3.4.0: temp-file. The contract ran on node 22 · linux alpine/x64 · docker and passed: getTempName generates prefixed and…
sha256:235cfa609edb85ce4b57123a4314bac8003f37f817eecba19e242c90399f16fa
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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 |
Case
HOW- Goal
- verify temp-file in pkg:npm/temp-file@3.4.0
- Packages
- Symbols
-
- temp-file
- Environment
- node 22.23.2
- Created
- 2026-08-26T11:09:13Z
Contract
- getTempName generates prefixed and unprefixed unique temporary file names
- TmpDir.getTempFile constructs temporary file paths with optional prefix and suffix
- TmpDir.getTempDir returns temporary directory path and createTempDir creates it on disk
- TmpDir.rootTempDir resolves to an existing base temporary directory
- TmpDir.cleanup asynchronously removes tracked files and removes base directory when last manager completes
- TmpDir.cleanup invokes custom disposer callbacks when multiple managers are active
- TmpDir.cleanupSync synchronously removes tracked temporary files and executes disposers
- TmpDir.toString returns the configured debug name
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
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 temp-file in pkg:npm/temp-file@3.4.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/temp-file@3.4.0
Demonstrate these symbols/APIs:
- temp-file
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:d122270bcedafed12291f58b60682574eddd9b61e3e12a09ee684504e5d87a2a","constraints":{"executionContext":"node"},"contract":["getTempName generates prefixed and unprefixed unique temporary file names","TmpDir.getTempFile constructs temporary file paths with optional prefix and suffix","TmpDir.getTempDir returns temporary directory path and createTempDir creates it on disk","TmpDir.rootTempDir resolves to an existing base temporary directory","TmpDir.cleanup asynchronously removes tracked files and removes base directory when last manager completes","TmpDir.cleanup invokes custom disposer callbacks when multiple managers are active","TmpDir.cleanupSync synchronously removes tracked temporary files and executes disposers","TmpDir.toString returns the configured debug name"],"goal":"verify temp-file in pkg:npm/temp-file@3.4.0","kind":"HOW","packages":["pkg:npm/temp-file@3.4.0"],"schemaVersion":1,"symbols":["temp-file"]},"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/temp-file@3.4.0"],"schemaVersion":1,"subject":"pkg:npm/temp-file@3.4.0","symbols":["temp-file"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-temp-file",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-temp-file",
"version": "1.0.0",
"dependencies": {
"temp-file": "3.4.0"
}
},
"node_modules/async-exit-hook": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/async-exit-hook/-/async-exit-hook-2.0.1.tgz",
"integrity": "sha512-NW2cX8m1Q7KPA7a5M2ULQeZ2wR5qI5PAbw5L0UOMxdioVk9PMZ0h1TmyZEkPYrCvYjDlFICusOu1dlEKAAeXBw==",
"license": "MIT",
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/fs-extra": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
"integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
"license": "MIT",
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
},
"engines": {
"node": ">=12"
}
},
"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/temp-file": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/temp-file/-/temp-file-3.4.0.tgz",
"integrity": "sha512-C5tjlC/HCtVUOi3KWVokd4vHVViOmGjtLwIh4MuzPo/nMYTV/p1urt3RnMz2IWXDdKEGJH3k5+KPxtqRsUYGtg==",
"license": "MIT",
"dependencies": {
"async-exit-hook": "^2.0.1",
"fs-extra": "^10.0.0"
}
},
"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-temp-file",
"version": "1.0.0",
"private": true,
"dependencies": {
"temp-file": "3.4.0"
}
}
{
"schemaVersion": 1,
"goal": "verify temp-file in pkg:npm/temp-file@3.4.0",
"kind": "HOW",
"packages": [
"pkg:npm/temp-file@3.4.0"
],
"symbols": [
"temp-file"
],
"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/strict';
import fs from 'node:fs';
import path from 'node:path';
import { getTempName, TmpDir } from 'temp-file';
// 1. getTempName generates prefixed and unprefixed unique temporary file names
{
const name1 = getTempName();
const name2 = getTempName();
assert.equal(typeof name1, 'string');
assert.ok(name1.length > 0);
assert.notEqual(name1, name2);
const prefixed = getTempName('custom-prefix');
assert.ok(prefixed.startsWith('custom-prefix-'));
const nullPrefixed = getTempName(null);
assert.ok(!nullPrefixed.startsWith('null'));
assert.ok(!nullPrefixed.startsWith('-'));
const undefinedPrefixed = getTempName(undefined);
assert.ok(!undefinedPrefixed.startsWith('undefined'));
assert.ok(!undefinedPrefixed.startsWith('-'));
}
// 2. TmpDir.getTempFile constructs temporary file paths with optional prefix and suffix
{
const tmpDir = new TmpDir('file-test');
const filePath1 = await tmpDir.getTempFile({ prefix: 'myprefix', suffix: 'txt' });
const filename1 = path.basename(filePath1);
assert.ok(filename1.startsWith('myprefix-'));
assert.ok(filename1.endsWith('-txt'));
const filePath2 = await tmpDir.getTempFile({ suffix: '.json' });
const filename2 = path.basename(filePath2);
assert.ok(filename2.endsWith('.json'));
assert.ok(!filename2.endsWith('-.json'));
const filePath3 = await tmpDir.getTempFile();
assert.ok(path.isAbsolute(filePath3));
assert.notEqual(filePath1, filePath3);
await tmpDir.cleanup();
}
// 3. TmpDir.getTempDir returns temporary directory path and createTempDir creates it on disk
{
const tmpDir = new TmpDir('dir-test');
const dirPath = await tmpDir.getTempDir({ prefix: 'planned-dir' });
assert.equal(fs.existsSync(dirPath), false);
const createdDirPath = await tmpDir.createTempDir({ prefix: 'created-dir' });
assert.equal(fs.existsSync(createdDirPath), true);
assert.equal(fs.statSync(createdDirPath).isDirectory(), true);
await tmpDir.cleanup();
assert.equal(fs.existsSync(createdDirPath), false);
}
// 4. TmpDir.rootTempDir resolves to an existing base temporary directory
{
const tmpDir = new TmpDir('root-test');
const rootDir = await tmpDir.rootTempDir;
assert.ok(typeof rootDir === 'string');
assert.ok(rootDir.length > 0);
assert.ok(path.isAbsolute(rootDir));
const tmpDir2 = new TmpDir('root-test-2');
const rootDir2 = await tmpDir2.rootTempDir;
assert.equal(rootDir, rootDir2);
await tmpDir.cleanup();
await tmpDir2.cleanup();
}
// 5. TmpDir.cleanup asynchronously removes tracked files and removes base directory when last manager completes
{
const activeManager = new TmpDir('active-keeper');
await activeManager.getTempFile();
const tmpDir = new TmpDir('cleanup-test');
const testFile = await tmpDir.getTempFile({ suffix: '.txt' });
fs.writeFileSync(testFile, 'hello world', 'utf8');
assert.equal(fs.existsSync(testFile), true);
const testSubDir = await tmpDir.createTempDir({ prefix: 'nested' });
const nestedFile = path.join(testSubDir, 'child.txt');
fs.writeFileSync(nestedFile, 'nested data', 'utf8');
assert.equal(fs.existsSync(nestedFile), true);
await tmpDir.cleanup();
assert.equal(fs.existsSync(testFile), false);
assert.equal(fs.existsSync(testSubDir), false);
await activeManager.cleanup();
}
// 6. TmpDir.cleanup invokes custom disposer callbacks when multiple managers are active
{
const activeManager = new TmpDir('keeper');
await activeManager.getTempFile();
const tmpDir = new TmpDir('disposer-test');
let disposedPath = null;
const customFile = await tmpDir.getTempFile({
disposer: async (file) => {
disposedPath = file;
if (fs.existsSync(file)) {
fs.unlinkSync(file);
}
},
});
fs.writeFileSync(customFile, 'custom dispose content', 'utf8');
await tmpDir.cleanup();
assert.equal(disposedPath, customFile);
assert.equal(fs.existsSync(customFile), false);
await activeManager.cleanup();
}
// 7. TmpDir.cleanupSync synchronously removes tracked temporary files and executes disposers
{
const tmpDir = new TmpDir('sync-test');
let syncDisposed = null;
const syncFile = await tmpDir.getTempFile({
suffix: '.sync',
disposer: async (file) => {
syncDisposed = file;
if (fs.existsSync(file)) {
fs.unlinkSync(file);
}
},
});
fs.writeFileSync(syncFile, 'sync content', 'utf8');
assert.equal(fs.existsSync(syncFile), true);
const syncDir = await tmpDir.createTempDir({ prefix: 'sync-dir' });
assert.equal(fs.existsSync(syncDir), true);
tmpDir.cleanupSync();
assert.equal(syncDisposed, syncFile);
assert.equal(fs.existsSync(syncFile), false);
assert.equal(fs.existsSync(syncDir), false);
}
// 8. TmpDir.toString returns the configured debug name
{
const named = new TmpDir('custom-debug-label');
assert.equal(named.toString(), 'custom-debug-label');
const defaultNamed = new TmpDir();
assert.equal(defaultNamed.toString(), '');
}
Origin Seeder
anonymous