Skip to content

Commit 84c3e76

Browse files
Update README.md (#278)
Added an alternative way of dealing with file saving in Frontend Libraries
1 parent 13e44d9 commit 84c3e76

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ ics.createEvent({
9191
}
9292

9393
writeFileSync(`${__dirname}/event.ics`, value)
94+
95+
/*
96+
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]
97+
const blob = new Blob([value], { type: 'text/calendar' });
98+
saveAs(blob, `${title}.ics`);
99+
100+
*/
94101
})
95102
```
96103

0 commit comments

Comments
 (0)