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

parse-data-uri

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-data-uri

parse a data uri into mime type and buffer

  • 0.2.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
209K
decreased by-4.33%
Maintainers
1
Weekly downloads
 
Created

What is parse-data-uri?

The parse-data-uri npm package is used to parse data URIs into their constituent parts, such as media type, data, and parameters. This can be useful for handling data URIs in web applications, particularly when dealing with inline data in HTML or CSS.

What are parse-data-uri's main functionalities?

Parse a data URI

This feature allows you to parse a data URI string and extract its components, such as media type, data, and parameters. The code sample demonstrates how to use the parse-data-uri package to parse a simple text data URI.

const parseDataUri = require('parse-data-uri');
const dataUri = 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==';
const parsed = parseDataUri(dataUri);
console.log(parsed);

Handle different media types

This feature shows how the package can handle different media types, such as images. The code sample demonstrates parsing a data URI that contains a base64-encoded PNG image.

const parseDataUri = require('parse-data-uri');
const imageDataUri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...';
const parsedImage = parseDataUri(imageDataUri);
console.log(parsedImage);

Extract base64 data

This feature allows you to extract the base64-encoded data from a data URI. The code sample demonstrates how to parse a data URI and then extract the base64 data from the parsed result.

const parseDataUri = require('parse-data-uri');
const dataUri = 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==';
const parsed = parseDataUri(dataUri);
const base64Data = parsed.data;
console.log(base64Data);

Other packages similar to parse-data-uri

Keywords

FAQs

Package last updated on 26 Aug 2014

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