Sample
content-disposition 0.5.4: contentDisposition, contentDisposition.parse
Verified sample for npm content-disposition 0.5.4: contentDisposition, contentDisposition.parse. The contract ran on node 22 · linux debian/x64 · docker and…
sha256:67731d5116dc147af2a04e858f068ac67442119a00c331f3df3860f846e35763
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 debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-16 |
Case
HOW- Goal
- verify pkg:npm/content-disposition@0.5.4
- Packages
- Symbols
-
- contentDisposition
- contentDisposition.parse
- Environment
- node 22.23.2
- Created
- 2026-09-16T22:27:18Z
Contract
- contentDisposition() generates attachment disposition without parameters when called with no arguments
- contentDisposition(filename) formats attachment disposition header with quoted basename
- contentDisposition(filename, { type }) supports custom disposition types including inline
- contentDisposition(filename) generates ISO-8859-1 fallback filename and RFC 5987 UTF-8 encoded filename* parameter for Unicode filenames
- contentDisposition(filename, { fallback }) supports custom fallback filename string and boolean false to omit fallback
- contentDisposition.parse(header) parses disposition header string into type and parameters map
- contentDisposition.parse(header) decodes RFC 5987 extended UTF-8 parameters into standard parameter keys
- contentDisposition.parse(header) throws TypeError on invalid arguments or malformed header syntax
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.cjs
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 pkg:npm/content-disposition@0.5.4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/content-disposition@0.5.4
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:340d22c23af8c86647360043db8ef100fac400776345276992b43537eb068ff9","constraints":{"executionContext":"node"},"contract":["contentDisposition() generates attachment disposition without parameters when called with no arguments","contentDisposition(filename) formats attachment disposition header with quoted basename","contentDisposition(filename, { type }) supports custom disposition types including inline","contentDisposition(filename) generates ISO-8859-1 fallback filename and RFC 5987 UTF-8 encoded filename* parameter for Unicode filenames","contentDisposition(filename, { fallback }) supports custom fallback filename string and boolean false to omit fallback","contentDisposition.parse(header) parses disposition header string into type and parameters map","contentDisposition.parse(header) decodes RFC 5987 extended UTF-8 parameters into standard parameter keys","contentDisposition.parse(header) throws TypeError on invalid arguments or malformed header syntax"],"goal":"verify pkg:npm/content-disposition@0.5.4","kind":"HOW","packages":["pkg:npm/content-disposition@0.5.4"],"schemaVersion":1,"symbols":["contentDisposition","contentDisposition.parse"]},"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","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/content-disposition@0.5.4"],"schemaVersion":1,"subject":"pkg:npm/content-disposition@0.5.4","symbols":["contentDisposition","contentDisposition.parse"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-content-disposition",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-content-disposition",
"version": "1.0.0",
"dependencies": {
"content-disposition": "0.5.4"
}
},
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
"license": "MIT",
"dependencies": {
"safe-buffer": "5.2.1"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"license": "MIT"
}
}
}
{
"name": "sample-content-disposition",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification for content-disposition",
"main": "src/index.js",
"dependencies": {
"content-disposition": "0.5.4"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/content-disposition@0.5.4",
"kind": "HOW",
"packages": [
"pkg:npm/content-disposition@0.5.4"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const contentDisposition = require('content-disposition');
/**
* Format a Content-Disposition header.
* @param {string} [filename] - File name or path
* @param {object} [options] - Options object
* @returns {string} Content-Disposition header value
*/
function createDisposition(filename, options) {
return contentDisposition(filename, options);
}
/**
* Parse a Content-Disposition header string.
* @param {string} header - Header string
* @returns {{ type: string, parameters: Record<string, string> }} Parsed disposition
*/
function parseDisposition(header) {
return contentDisposition.parse(header);
}
module.exports = {
contentDisposition,
createDisposition,
parseDisposition
};
const assert = require('node:assert');
const contentDisposition = require('content-disposition');
const { createDisposition, parseDisposition } = require('../src/index.js');
// 1. contentDisposition() generates attachment disposition without parameters when called with no arguments
assert.strictEqual(contentDisposition(), 'attachment');
assert.strictEqual(createDisposition(), 'attachment');
// 2. contentDisposition(filename) formats attachment disposition header with quoted basename
assert.strictEqual(
contentDisposition('report.pdf'),
'attachment; filename="report.pdf"'
);
assert.strictEqual(
contentDisposition('nested/directory/archive.tar.gz'),
'attachment; filename="archive.tar.gz"'
);
// 3. contentDisposition(filename, { type }) supports custom disposition types including inline
assert.strictEqual(
contentDisposition('photo.jpg', { type: 'inline' }),
'inline; filename="photo.jpg"'
);
assert.strictEqual(
contentDisposition(undefined, { type: 'inline' }),
'inline'
);
// 4. contentDisposition(filename) generates ISO-8859-1 fallback filename and RFC 5987 UTF-8 encoded filename* parameter for Unicode filenames
assert.strictEqual(
contentDisposition('€ rates.txt'),
'attachment; filename="? rates.txt"; filename*=UTF-8\'\'%E2%82%AC%20rates.txt'
);
// 5. contentDisposition(filename, { fallback }) supports custom fallback filename string and boolean false to omit fallback
assert.strictEqual(
contentDisposition('€ rates.txt', { fallback: 'euro_rates.txt' }),
'attachment; filename="euro_rates.txt"; filename*=UTF-8\'\'%E2%82%AC%20rates.txt'
);
assert.strictEqual(
contentDisposition('€ rates.txt', { fallback: false }),
'attachment; filename*=UTF-8\'\'%E2%82%AC%20rates.txt'
);
// 6. contentDisposition.parse(header) parses disposition header string into type and parameters map
const basicParsed = parseDisposition('attachment; filename="plans.pdf"');
assert.strictEqual(basicParsed.type, 'attachment');
assert.deepStrictEqual(basicParsed.parameters, { filename: 'plans.pdf' });
const inlineParsed = parseDisposition('inline');
assert.strictEqual(inlineParsed.type, 'inline');
assert.deepStrictEqual(inlineParsed.parameters, {});
// 7. contentDisposition.parse(header) decodes RFC 5987 extended UTF-8 parameters into standard parameter keys
const extendedParsed = parseDisposition(
"attachment; filename=\"EURO rates.txt\"; filename*=UTF-8''%e2%82%ac%20rates.txt"
);
assert.strictEqual(extendedParsed.type, 'attachment');
assert.deepStrictEqual(extendedParsed.parameters, { filename: '€ rates.txt' });
// 8. contentDisposition.parse(header) throws TypeError on invalid arguments or malformed header syntax
assert.throws(() => {
parseDisposition(null);
}, TypeError);
assert.throws(() => {
parseDisposition('attachment; filename=');
}, TypeError);
console.log('Contract tests passed successfully.');
Origin Seeder
anonymous