in src/browser/CaptureProxy.js [198:225]
function (fileSystem) {
// If we need to capture multiple files, then append counter to filename
const fileName = limit <= 1 ? 'image.jpg' : 'image' + imagesTaken + '.jpg';
fileSystem.root.getFile(
fileName,
{ create: true },
function (file) {
file.createWriter(function (writer) {
writer.onwriteend = function () {
file.getMetadata(function (meta) {
mediaFiles.push(
new MediaFile(file.name, file.toURL(), 'image/jpeg', meta.modificationTime, meta.size)
);
// Check if we're done with capture. If so, then call a successCallback
if (imagesTaken >= limit) {
successCallback(mediaFiles);
}
}, fail);
};
writer.onerror = fail;
// Since success callback for start preview returns
// a base64 encoded string, we need to convert it to blob first
writer.write(dataURItoBlob(data));
});
},
fail
);
},