"use strict";

module.exports = function fileToDataURL(dataUrl) {
	return new Promise((resolve, reject) => {
		const reader = new FileReader();

		reader.onload = function(event) {
			resolve(event.target.result);
		};

		reader.onerror = function(event) {
			// FIXME: Verify that this works
			reject(event.error);
		};
		
		reader.readAsDataURL(dataUrl);
	});
};
