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

libmime

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libmime

Encode and decode quoted printable and base64 strings

  • 5.3.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9M
decreased by-3.37%
Maintainers
1
Weekly downloads
 
Created

What is libmime?

The libmime npm package is a utility library for handling MIME types. It provides functionalities for parsing and formatting MIME types, which are essential for handling file types and content negotiation in web and email development. With libmime, developers can easily determine the MIME type of a file, create MIME-encoded words, and parse MIME-encoded strings.

What are libmime's main functionalities?

Determining MIME type from a filename

This feature allows you to get the MIME type of a file based on its extension. It's useful for setting Content-Type headers when serving files over HTTP.

const libmime = require('libmime');
const mimeType = libmime.getType('example.pdf');
console.log(mimeType); // 'application/pdf'

Getting a file extension from a MIME type

This functionality enables you to find the appropriate file extension for a given MIME type, which can be useful when generating files dynamically.

const libmime = require('libmime');
const extension = libmime.getExtension('application/pdf');
console.log(extension); // 'pdf'

Encoding and decoding MIME-encoded words

libmime can encode and decode MIME-encoded words, which is particularly useful for handling email headers that include characters outside the ASCII range.

const libmime = require('libmime');
const encodedWord = libmime.encodeWord('Hello äöü', 'Q');
const decodedWord = libmime.decodeWord(encodedWord);
console.log(encodedWord);
console.log(decodedWord);

Other packages similar to libmime

Keywords

FAQs

Package last updated on 29 Nov 2024

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