Optional
aInstancePtr: objectA run time mechanism for interface discovery.
NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.
aInstancePtr must not be null.
[in] A requested interface IID
[out] A pointer to an interface pointer to receive the result.
Retrieves an nsIMIMEInfo using both the extension and the type of a file. The type is given preference during the lookup. One of aMIMEType and aFileExt can be an empty string. At least one of aMIMEType and aFileExt must be nonempty.
Returns an nsIMIMEInfo for the provided MIME type and extension obtained from an OS lookup. If no handler is found for the type and extension, returns a generic nsIMIMEInfo object. The MIME type and extension can be the empty string. When the type and extension don't map to the same handler, the semantics/resolution are platform specific. See the platform implementations for details.
A nsIMIMEInfo object. This function must return a MIMEInfo object if it can allocate one. The only justifiable reason for not returning one is an out-of-memory error.
The MIME type to get handler information for.
The filename extension to use either alone or with the MIME type to get handler information for. UTF-8 encoded.
Given a Type/Extension combination, returns the default extension for this type. This may be identical to the passed-in extension.
The Type to get information on. Must not be empty.
File Extension. Can be empty.
Retrieves a ACString representation of the MIME type associated with this URI. The association is purely file extension to MIME type based. No attempt to determine the type via server headers or byte scanning is made.
The MIME type, if any.
Generate a valid filename from the channel that can be used to save the content of the channel to the local disk.
The filename is determined from the content disposition, the filename of the uri, or a default filename. The following modifications are applied:
If the VALIDATE_NO_DEFAULT_FILENAME flag is not specified, and after the rules above are applied, the resulting filename is empty, a default filename is used.
If the VALIDATE_ALLOW_EMPTY flag is specified, an empty string may be returned only if the filename could not be determined or was blank.
If either the VALIDATE_SANITIZE_ONLY or VALIDATE_GUESS_FROM_EXTENSION flags are specified, then the content type may be empty. Otherwise, the type must not be empty.
The aOriginalURI would be specified if the channel is for a local file but it was originally sourced from a different uri.
When saving an image, use validateFileNameForSaving instead and pass the result of imgIRequest::GetFileName() as the filename to check.
The resulting filename.
The channel of the content to save.
The MIME type to use, which would usually be the same as the content type of the channel.
one or more of the flags above.
Similar to getValidFileName, but used when a specific filename needs to be validated. The filename is modified as needed based on the content type in the same manner as getValidFileName.
If the filename came from a uri, it should not be escaped, that is, any needed unescaping of the filename should happen before calling this method.
The validated filename.
The filename to validate.
The MIME type to use.
one or more of the flags above.
Generated using TypeDoc
The MIME service is responsible for mapping file extensions to MIME-types (see RFC 2045). It also provides access to nsIMIMEInfo interfaces and acts as a general convenience wrapper of nsIMIMEInfo interfaces.
The MIME service maintains a database with a one MIME type to many file extensions rule. Adding the same file extension to multiple MIME types is illegal and behavior is undefined.
See
nsIMIMEInfo