Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adrianlee44/ical2json
A simple node package to convert ical data to json
https://github.com/adrianlee44/ical2json
converter ics json
Last synced: 5 days ago
JSON representation
A simple node package to convert ical data to json
- Host: GitHub
- URL: https://github.com/adrianlee44/ical2json
- Owner: adrianlee44
- License: mit
- Created: 2013-11-14T09:15:13.000Z (about 11 years ago)
- Default Branch: main
- Last Pushed: 2024-10-05T22:03:27.000Z (about 1 month ago)
- Last Synced: 2024-10-05T22:07:05.504Z (about 1 month ago)
- Topics: converter, ics, json
- Language: TypeScript
- Size: 1.05 MB
- Stars: 66
- Watchers: 5
- Forks: 12
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ical2json
A simple node package to convert iCal data (.ics file) to JSON format
![Tests](https://github.com/adrianlee44/ical2json/workflows/Tests/badge.svg)
[![codecov](https://codecov.io/gh/adrianlee44/ical2json/graph/badge.svg?token=SIFGIFEB7T)](https://codecov.io/gh/adrianlee44/ical2json)## Getting started
Download and install from npm
```
npm install -g ical2json
```To convert ics file to json
```sh
$ ical2json ./US-Holiday.ics
```The json output will be written to a `.json` file in the same directory
```
./US-Holiday.json
```To write the output to a separate directory, use the `-o` or `--output-dir` option
```sh
$ ical2json --output-dir ~/destination/directory ./US-Holiday.ics
```File output:
```json
{
"VCALENDAR": [
{
"PRODID": "-//Calendar Labs//Calendar 1.0//EN",
"VERSION": "2.0",
"CALSCALE": "GREGORIAN",
"METHOD": "PUBLISH",
"X-WR-CALNAME": "Usa Holidays",
"X-WR-TIMEZONE": "America/New_York",
"VEVENT": [
{
"DTSTART;VALUE=DATE": "20130101",
"DTEND;VALUE=DATE": "20130102",
"DTSTAMP": "20111213T124028Z",
"UID": "[email protected]",
"CREATED": "20111213T123901Z",
"DESCRIPTION": "Visit http",
"LAST-MODIFIED": "20111213T123901Z",
"LOCATION": "",
"SEQUENCE": "0",
"STATUS": "CONFIRMED",
"SUMMARY": "New Year's Day",
"TRANSP": "TRANSPARENT"
},
{
"DTSTART;VALUE=DATE": "20130121",
"DTEND;VALUE=DATE": "20130122",
"DTSTAMP": "20111213T124028Z",
"UID": "[email protected]",
"CREATED": "20111213T123901Z",
"DESCRIPTION": "Visit http",
"LAST-MODIFIED": "20111213T123901Z",
"LOCATION": "",
"SEQUENCE": "0",
"STATUS": "CONFIRMED",
"SUMMARY": "M L King Day",
"TRANSP": "TRANSPARENT"
},
{
"DTSTART;VALUE=DATE": "20130214",
"DTEND;VALUE=DATE": "20130215",
"DTSTAMP": "20111213T124028Z",
"UID": "[email protected]",
"CREATED": "20111213T123901Z",
"DESCRIPTION": "Visit http",
"LAST-MODIFIED": "20111213T123901Z",
"LOCATION": "",
"SEQUENCE": "0",
"STATUS": "CONFIRMED",
"SUMMARY": "Valentine's Day",
"TRANSP": "TRANSPARENT"
}
]
}
]
}
```## API
```
Usage: ical2json [options] [FILES...]Options:
-V, --version output the version number
-r, --revert Revert JSON to ical
-o, --output-dir Output directory
-h, --help display help for command
```Programmatic API
```
var ical2json = require("ical2json");// From ical to JSON
var output = ical2json.convert(icalData);// From JSON to ical
var icalOutput = ical2json.revert(icalJson);
```