MIME type detection and multipart parsing for Dart
open sourceBSD-3-Clausefree
mime is the Dart team's package for working with media (MIME) types: it works out a file's MIME type from its name's extension or the magic bytes at the start of its contents, with a built-in resolver for the common types (lookupMimeType) and custom resolvers you add extensions and magic numbers to. It also parses streams of MIME multipart data, such as multipart/form-data uploads, into their parts and headers. It lives in the dart-lang/tools mono-repo and is published on pub.dev by tools.dart.dev.
Problems it solves
- work out a file's content type from its name or first bytes in Dart
- read the parts of a multipart/form-data upload in a Dart server
- set the right Content-Type header when serving files from Dart
Features
- Detects a file's MIME type from its extension or magic bytes
- Built-in resolver for common types, plus custom extensions and magic numbers
- Parses MIME multipart streams into parts with headers
