utils/files.js
async function readFile(path, encoding) {
	const url = browser.extension.getURL(realpath(path));

	return new Promise((resolve, reject) => {
		const xhr = new global.XMLHttpRequest;
		xhr.responseType = encoding == null ? 'arraybuffer' : 'text';
		xhr.addEventListener('load', () => resolve(xhr.response));
		xhr.addEventListener('error', reject);
		xhr.open('GET', url);
		xhr.send();
	});
}
async function readFile(path, encoding) {
	const url = browser.extension.getURL(realpath(path));

	return new Promise((resolve, reject) => {
		const xhr = new global.XMLHttpRequest;
		xhr.responseType = encoding == null ? 'arraybuffer' : 'text';
		xhr.addEventListener('load', () => resolve(xhr.response));
		xhr.addEventListener('error', reject);
		xhr.open('GET', url);
		xhr.send();
	});
}
async function readFile ( path , encoding ) { const url = browser . extension . getURL ( realpath ( path ) ) ; return new Promise ( ( resolve , reject ) => { const xhr = new global . XMLHttpRequest ; xhr . responseType = encoding == null ? 'arraybuffer' : 'text' ; xhr . addEventListener ( 'load' , ( ) => resolve ( xhr . response ) ) ; xhr . addEventListener ( 'error' , reject ) ; xhr . open ( 'GET' , url ) ; xhr . send ( ) ; } ) ; }
Loads a file included in the extension.
@param  {string}  path      Absolute path of the file to read.
@param  {string}  encoding  Optional. Allowed values: 'utf-8'
@return {any}               [description]
Loads a file included in the extension .