Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to parse ical string #71

Closed
shavo007 opened this issue Nov 22, 2016 · 1 comment
Closed

How to parse ical string #71

shavo007 opened this issue Nov 22, 2016 · 1 comment

Comments

@shavo007
Copy link

Hi,

I am currently storing an ical file in aws s3 bucket. I download the file and convert to string.

I then call ical parse method which returns an object. How do i traverse on this object to inspect the entries?

Sample code:

  var putObjectPromise = s3.getObject(getParams).promise();

    putObjectPromise.then(
            (data) => {
                var objectData = data.Body.toString('utf-8'); // Use the encoding necessary
                var cal = ical.parseICS(objectData);
                console.log(`calendar is  ${cal.toString()}`);
}

Is it like:

  for (var k in cal) {
                    if (data.hasOwnProperty(k)) {
                        var ev = data[k]
                            // Pick out the data relevant to us and create an object to hold it.
                        var eventData = {
                                summary: removeTags(ev.summary)
                            }
                            // add the newly created object to an array for use later.
                        eventList.push(eventData);
                        console.log(`event data is ${eventData.summary}`);
                    }
                }



Thanks,
Shane.

@shavo007
Copy link
Author

My bat!!

have an incorrect reference in the loop. should be cal.hasOwnProperty(k) ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant