let inputFile;
let outputFile;
let direction = "decode";
function decode(file) {
readFileData: function readFileData(elem, fileId, startOffset, count) {
var readPromise = getArrayBufferFromFileAsync(elem, fileId);
return readPromise.then(function (arrayBuffer) {
var uint8Array = new Uint8Array(arrayBuffer, startOffset, count);
var base64 = uint8ToBase64(uint8Array);
return base64;
});
}
}
function encode(file) {
}
function start(file) {
if(direction == "decode") {
decode(file);
}
else if(direction == "encode") {
encode(file);
}
else throw("Invalid direction");
}
(function () {
window.BlazorInputFile = {
init: function init(elem, componentInstance) {
var nextFileId = 0;
elem.addEventListener('change', function handleInputFileChange(event) {
// Reduce to purely serializable data, plus build an index by ID
elem._blazorFilesById = {};
var fileList = Array.prototype.map.call(elem.files, function (file) {
var result = {
id: ++nextFileId,
lastModified: new Date(file.lastModified).toISOString(),
name: file.name,
size: file.size,
type: file.type
};
elem._blazorFilesById[result.id] = result;
// Attach the blob data itself as a non-enumerable property so it doesn't appear in the JSON
Object.defineProperty(result, 'blob', { value: file });
return result;
});
componentInstance.invokeMethodAsync('NotifyChange', fileList).then(null, function (err) {
throw new Error(err);
});
});
},
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.