Generates a local URI from a String or Typed Array, with fallbacks for older browsers.
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!"
})
MIT. See LICENSE.md for details.