Skip to content

Commit

Permalink
Update README.md (#278)
Browse files Browse the repository at this point in the history
Added an alternative way of dealing with file saving in Frontend Libraries
  • Loading branch information
KudahShambare authored Sep 18, 2024
1 parent 13e44d9 commit 84c3e76
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ ics.createEvent({
}

writeFileSync(`${__dirname}/event.ics`, value)

/*
You cannot use fs in Frontend libraries like React so you rather import a module to save files to the browser as follow [ import { saveAs } from 'file-saver'; // For saving the file in the browser]
const blob = new Blob([value], { type: 'text/calendar' });
saveAs(blob, `${title}.ics`);
*/
})
```

Expand Down

0 comments on commit 84c3e76

Please sign in to comment.