local-uri

1.0.0 • Public • Published

local-uri

Generates a local URI from a String or Typed Array, with fallbacks for older browsers.

Usage

NPM

uri = createURI(data, type)

data is a String or Typed Array (e.g. Float32Array), and will be the content recieved when the uri is requested.

type is the mime type to use for the URI. Defaults to text/plain;charset=US-ASCII.

var createURI = require('local-uri')
var xhr       = require('xhr')

var uri = createURI('hello world!')

xhr({ uri: uri }, function(err, res, body) {
  console.log(body) // "hello world!"
})

License

MIT. See LICENSE.md for details.

Package Sidebar

Install

npm i local-uri

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • hughsk