function getCharset
getCharset(type: string): string | undefinedGiven a media type or header value, identify the encoding charset. If the
charset cannot be determined, the function returns undefined.
Examples
Example 1
Example 1
import { getCharset } from "@std/media-types/get_charset"; getCharset("text/plain"); // "UTF-8" getCharset("application/foo"); // undefined getCharset("application/news-checkgroups"); // "US-ASCII" getCharset("application/news-checkgroups; charset=UTF-8"); // "UTF-8"
Parameters
type: stringReturn Type
string | undefined