JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14817
  • Score
    100M100P100Q130950F
  • License MIT

Parser for `data:` URIs

Package Exports

  • strong-data-uri

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (strong-data-uri) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

strong-data-uri

Build Status NPM version

Overview

strong-data-uri is implements a parser for retrieving data encoded in data: URIs specified by RFC2397.

Usage

var dataUri = require('strong-data-uri');
var uri = 'data:text/plain;base64,aGVsbG8gd29ybGQ=';

var buffer = dataUri.decode(uri);
console.log(buffer);
// <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
console.log(buffer.toString('ascii'));
// Hello world

Status

The module can parse both base64-encoded and url-encoded URLs at the moment.

Things that would be nice to have too:

  • Parse mediaType information and extract charset (encoding) value. This is needed to convert the returned Buffer into a string in cases where the application has to support arbitrary encodings.

  • Implement encode() function for creating data URLs.