github jshttp/content-disposition v2.0.0

4 hours ago

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

  • Rename exports (#123) ec3a844
    • No default export, use create export instead
  • Removed basename from create, pass a filename instead of a full path
  • Refactor parser to be faster and lenient (e.g. now parses unicode)
  • Change filename in create to ASCII only (#132) 3190b76
  • Null object performance bump (#124) 7c7c9c0
  • Remove fallback behavior from decoder (#127) 7086236
    • Invalid UTF-8 is no longer supported
  • Refactor project to TypeScript (#118) 4fbf7ff

Added


v1.1.0...v2.0.0

Don't miss a new content-disposition release

NewReleases is sending notifications on new releases.