You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
470 B
19 lines
470 B
2 years ago
|
var defaults = require('./defaults');
|
||
|
var isBlob = require('./isBlob');
|
||
|
var isFile = require('./isFile');
|
||
|
var Blob = require('./Blob');
|
||
|
var toArr = require('./toArr');
|
||
|
exports = function(data, options) {
|
||
|
options = options || {};
|
||
|
defaults(options, defOpts);
|
||
|
if (!isBlob(data) && !isFile(data)) {
|
||
|
data = new Blob(toArr(data), options);
|
||
|
}
|
||
|
return URL.createObjectURL(data);
|
||
|
};
|
||
|
var defOpts = {
|
||
|
type: 'text/plain'
|
||
|
};
|
||
|
|
||
|
module.exports = exports;
|