Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fr.onload = evt => {
JSZip.loadAsync( fr.result )
.then( z => this.importZipSourceFiles(z) );
};
fr.readAsArrayBuffer( file );
loadArduboy( buff, cb ){
let zip;
let source = this.model.getModel( this.model.getItem("ram.srcpath"), true);
JSZip.loadAsync( buff )
.then( z => (zip=z).file("info.json").async("text") )
.then( info => zip.file( JSON.parse( fixJSON(info) ).binaries[0].filename).async("text") )
.then( hex => {
source.setItem(["build.hex"], hex);
this.model.setItem("app.AT32u4.hex", hex);
cb();
});
function fixJSON( str ){
if( str.charCodeAt(0) == 0xFEFF )
str = str.substr(1);
return str.replace(/\,(?!\s*?[\{\[\"\'\w])/g, '');
}
.then( buff => JSZip.loadAsync( buff ) )
.then( z => this.importZipSourceFiles(z) );