Skip to content

mk-pmb/json-data-uri-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published