Comments (2)
If you're using something like Express with a REST endpoint, your final response will be something like this:
res
.set(
'Content-Disposition',
'attachment; filename="${FILE_NAME}.ics"',
)
.set('Content-Type', 'text/calendar')
.status(200)
.send(ics);
}
They key is to set your HTTP headers so clients know how to handle the response (in this case, an ics text file).
The ics is either generated in a function prior to the final response code above, or perhaps loaded from a cached source (in the case of a feed you probably don't want to regenerate it on every request, so you have other mechanisms to update the feed snapshot).
from ics.
For the use case where you're generating client side, you can use the popular library downloadjs or create a simple utility function.
function downloadFile(config: { fileContents: any; fileName: string; mimeType: string }) {
const { mimeType, fileContents, fileName } = config
const blob = new Blob([fileContents], { type: mimeType })
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.setAttribute('href', url)
link.setAttribute('download', fileName)
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
// ...
downloadFile({
mimeType: 'text/calendar',
fileContents: value,
fileName: 'meeting.ics',
})
from ics.
Related Issues (20)
- Documentation does not cover using this package Client Side
- Calendar Side Panel in OS X Outlook?
- Callbacks and errors HOT 1
- Calendar Notifications/Alarms Not Working
- Separate calendar options from event options
- Handle organizer names with special characters correctly HOT 1
- Adding long descriptions to ICS file causes email to get lost on Outlook
- Unicode emails not passing validation check
- Faulty trigger when alert `before` is set to false.
- PARTSTAT = Accepted (and others) not working in Outlook
- Support cloudflare worker environment
- When the title contains emojis, it is unable to generate a correct summary
- Add REFRESH-INTERVAL
- Trigger is encoded twice HOT 2
- Client specific attribute X-GOOGLE-CONFERENCE HOT 1
- Allow DTSTAMP to be set like any other event attribute
- Issues with runes2 import HOT 7
- TypeError: R.object is not a function. (In 'R.object()', 'R.object' is undefined)"
- Feed not working on Google but working on Apple Calendar
- Return Value Out of Scope All of a Sudden?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ics.