
Research
/Security News
10 npm Typosquatted Packages Deploy Multi-Stage Credential Harvester
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.
media-typer
Advanced tools
Simple RFC 6838 media type parser.
This module will parse a given media type into it's component parts, like type, subtype, and suffix. A formatter is also provided to put them back together and the two can be combined to normalize media types into a canonical form.
If you are looking to parse the string that represents a media type and it's
parameters in HTTP (for example, the Content-Type header), use the
content-type module.
This is a Node.js module available through the
npm registry. Installation is done using the
npm install command:
$ npm install media-typer
var typer = require('media-typer')
var obj = typer.parse('image/svg+xml')
Parse a media type string. This will return an object with the following
properties (examples are shown for the string 'image/svg+xml; charset=utf-8'):
type: The type of the media type (always lower case). Example: 'image'
subtype: The subtype of the media type (always lower case). Example: 'svg'
suffix: The suffix of the media type (always lower case). Example: 'xml'
If the given type string is invalid, then a TypeError is thrown.
var obj = typer.format({ type: 'image', subtype: 'svg', suffix: 'xml' })
Format an object into a media type string. This will return a string of the
mime type for the given object. For the properties of the object, see the
documentation for typer.parse(string).
If any of the given object values are invalid, then a TypeError is thrown.
var valid = typer.test('image/svg+xml')
Validate a media type string. This will return true is the string is a well-
formatted media type, or false otherwise.
The 'content-type' package is similar to media-typer as it provides utilities for parsing and formatting Content-Type header strings. It differs in that it focuses specifically on the Content-Type header and provides more functionality around charset handling and parameter parsing.
The 'mime-types' package is another similar package that allows for looking up the content-type associated with a file extension and vice versa. It provides a larger database of MIME types but does not focus on parsing and formatting of media type strings as media-typer does.
The 'negotiator' package is used for content negotiation in HTTP transactions. It can parse Accept headers and determine the best match for a response. While it deals with media types, its primary focus is on the negotiation process rather than just parsing and formatting media types.
FAQs
Simple RFC 6838 media type parser and formatter
The npm package media-typer receives a total of 51,549,557 weekly downloads. As such, media-typer popularity was classified as popular.
We found that media-typer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.