Skip to content

express.static.mime is not exported in Express 5.x #6330

Closed
expressjs/expressjs.com
#1783
@mxxk

Description

@mxxk

Description

Express 4.x used to export the mime transitive dependency as express.static.mime:

Express 5.x no longer provides this export, but its documentation still references it:

Image

The newer version [email protected] no longer exports mime, so I'm not sure if this would be considered a documentation issue with Express 5.x, or a bug (which would require changes to serve-static and send). Would you please confirm?

Expectations

If this is considered a documentation issue, here is a proposed revision to the documentation of res.type(type) which would remedy the inconsistency:

 If `type` contains the “/” character, then it sets the `Content-Type` to the
 exact value of `type`, otherwise it is assumed to be a file extension and the
 MIME type is looked up
-in a mapping using the `express.static.mime.lookup()` method.
+using the `lookup` method of the `mime-types` package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions