Skip to content

Instantly share code, notes, and snippets.

Created August 22, 2017 15:03
Show Gist options
  • Save anonymous/f4b5e6b2cdd41a1426d7572f18e7e926 to your computer and use it in GitHub Desktop.
Save anonymous/f4b5e6b2cdd41a1426d7572f18e7e926 to your computer and use it in GitHub Desktop.
WQpwjw
var arr =
"QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KUFJPRElEOkUzIEV4dGVybmFsIEV4cGVydCBFdmVudCB0b29sDQpNRVRIT0Q6UFVCTElTSA0KVFo6KyAwMA0KWC1NUy1PTEstRk9SQ0VJTlNQRUNUT1JPUEVOOlRSVUUNCkJFR0lOOlZFVkVOVA0KVUlEOjhiYTEwY2EyLWRiMDMtNDIyNi1iODAwLTcwNzhiMzUyYmM5Mw0KRFRTVEFSVDoyMDE1MTIwMVQxMDAwMDBaDQpEVEVORDoyMDE1MTIwMVQxMjAwMDBaDQpTVU1NQVJZOlRlc3QgRXZlbnQNCkxPQ0FUSU9OOlJvb20gMTIzDQpQUklPUklUWTozDQpTRVFVRU5DRTowDQpUUkFOU1A6T1BBUVVFDQpDQVRFR09SSUVTOiBFdmVudCBleHBvcnRlZCBmcm9tIEUzIHRvb2wNCkNMQVNTOlBVQkxJQw0KWC1NSUNST1NPRlQtQ0RPLUJVU1lTVEFUVVM6QlVTWQ0KWC1NSUNST1NPRlQtQ0RPLUlNUE9SVEFOQ0U6MQ0KWC1NSUNST1NPRlQtRElTQUxMT1ctQ09VTlRFUjpGQUxTRQ0KRU5EOlZFVkVOVA0KRU5EOlZDQUxFTkRBUg0K";
var decodeBase64 = function(s) {
var e={},i,b=0,c,x,l=0,a,r='',w=String.fromCharCode,L=s.length;
var A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
for(i=0;i<64;i++){e[A.charAt(i)]=i;}
for(x=0;x<L;x++){
c=e[s.charAt(x)];b=(b<<6)+c;l+=6;
while(l>=8){((a=(b>>>(l-=8))&0xff)||(x<(L-2)))&&(r+=w(a));}
}
return r;
};
var from64str = decodeBase64(arr);
console.log(from64str);
var a = window.document.createElement('a');
function createObjectURL ( file ,mime) {
if ( window.webkitURL ) {
return window.webkitURL.createObjectURL( file ,mime);
} else if ( window.URL && window.URL.createObjectURL ) {
return window.URL.createObjectURL( file ,mime);
} else {
return null;
}
}
a.href = createObjectURL(new Blob([from64str]),{type:'text/calendar'});
a.download = "My Download.ics";
// Append anchor to body.
document.body.appendChild(a)
a.click();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment