Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

content-type

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

content-type

Create and parse HTTP Content-Type header

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33M
decreased by-2.47%
Maintainers
1
Weekly downloads
 
Created

What is content-type?

The content-type npm package is used to create and parse HTTP Content-Type header according to RFC 7231. It allows you to parse content-type strings to objects and format content-type objects to strings.

What are content-type's main functionalities?

Parsing Content-Type

This feature allows you to parse a Content-Type string, returning an object with the media type and parameters like charset.

const contentType = require('content-type');
const parsed = contentType.parse('text/html; charset=utf-8');

Formatting Content-Type

This feature enables you to format an object representing a Content-Type into a string that can be used in HTTP headers.

const contentType = require('content-type');
const format = contentType.format({ type: 'text/html', parameters: { charset: 'utf-8' } });

Other packages similar to content-type

Keywords

FAQs

Package last updated on 29 Jan 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc