New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

json-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

json-data-uri

Parse and encode (plain or Base64) data URIs with JSON content and correct MIME type.

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

json-data-uri

Parse and encode (plain or Base64) data URIs with JSON content and correct MIME type.

API

This module exports an object that holds these functions:

parse(uri)

Try to parse JSON data from a data URI given as string uri. Returns decoded data, or undefined if there was an error.

toPlainUri(data)

Convert JSON-able data to a plain text data: URI. Returns a URI as a string. With bad input, the content part of the URI will be broken.

toBase64Uri(data)

Convert JSON-able data to a base64-encoded data: URI. Returns a URI as a string. With bad input, the content part of the URI will be broken.

Usage

see test/usage.mjs.

Known issues

  • Needs more/better tests and docs.

 

License

ISC

Keywords

base64

FAQs

Package last updated on 18 Nov 2022

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