Called ics.js (link below),I had to edit it slightly to remove the references to the browser navigator object, and then delete the part that triggers the browser to actually save to disk and instead just grab the text output and use a FileFolder object in AppStudio to save to a text file with an *.ics extension.
Seems to be working so far, although I haven't tested much. I'm not sure what happens around timezones etc. Will have to do some testing...
text: 'get calendar'
var cal = ICS.ics();
var subject = 'test subject'
var description = 'test description'
var location = 'test location'
var begin = new Date();
var end = new Date();
cal.addEvent(subject, description, location, begin, end);
var c = cal.download()