input[type="file"]
var blob = new Blob([ 'Привет, мир!' ], { type: 'text/plain' });
var url = URL.createObjectURL(blob);
var request = new XMLHttpRequest();
request.open('GET', url, false);
request.send(null);
var u8a = new TextEncoder().encode(request.responseText);
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
var bytes = u8a, i, len = bytes.length, base64 = '';
for (i = 0; i < len; i += 3) {
base64 += chars[bytes[i] >> 2];
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
base64 += chars[bytes[i + 2] & 63];
}
if (len % 3 === 2) {
base64 = base64.substring(0, base64.length - 1) + '=';
}
else if (len % 3 === 1) {
base64 = base64.substring(0, base64.length - 2) + '==';
}
var data_url = 'data:'+blob.type+';charset=utf-8;base64,' + base64;
console.log(data_url);