content-disposition
3.0.0 · 13 Aug 2026MIT211.4M / weekRepositoryHomepagenpmAtom feed
2.0.1 is the newest release of 2.x.
In short
3 new7 changed
Release note
Large refactor to make the parser 3x faster and lenient on input. Removes the default export and renames it to create.
import { create, parse, format } from 'content-disposition';
create('filename');
parse(
'attachment; filename="EURO rates.txt"; filename*=UTF-8\'\'%e2%82%ac%20rates.txt',
);
format({
type: 'attachment',
parameters: {
filename: '€ rates.txt',
},
});Adds a multipart option that can be used to parse the header within multipart/form-data appropriately.
Note: The filename in create is no longer normalized with basename, ensure you are using appropriate filenames and not exposing your directory structure by using absolute paths.
Changed
No default export, use
createexport instead
Removed
basenamefromcreate, pass a filename instead of a full pathRefactor parser to be faster and lenient (e.g. now parses unicode)
Remove fallback behavior from decoder (#127) 7086236
Invalid UTF-8 is no longer supported
Added