You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it is possible to go from a file extension to a MIME type using TypeForExtension, but the converse is missing. This is useful in applications where it is saving or producing new content of variable type, and needs to know the expected extension.
This is the symmetric partner of TypeForExtension, it determines the file extensions for the given type (formatted per RFC 1521, so accepted by ParseMediaType). It does not consider any optional parameters.
The error return value is used solely where the provided MIME type does not parse, distinct from 'no extensions registered', which is an empty slice.
The text was updated successfully, but these errors were encountered:
Testing ExtensionByType() with mime text/html under OS X 10.10.4. running go1.5beta1 darwin/amd64 produces inconsistent results. I noticed that in about 1/10 cases it returns .html instead of .htm.
Currently it is possible to go from a file extension to a MIME type using TypeForExtension, but the converse is missing. This is useful in applications where it is saving or producing new content of variable type, and needs to know the expected extension.
Proposed API:
func ExtensionsForType(typ string) ([]string, error)
This is the symmetric partner of TypeForExtension, it determines the file extensions for the given type (formatted per RFC 1521, so accepted by ParseMediaType). It does not consider any optional parameters.
The error return value is used solely where the provided MIME type does not parse, distinct from 'no extensions registered', which is an empty slice.
The text was updated successfully, but these errors were encountered: