From 84c3e76d97635dc3babb490a65f6b5327742c498 Mon Sep 17 00:00:00 2001 From: Kudakwashe Shambare <70160442+KudahShambare@users.noreply.github.com> Date: Wed, 18 Sep 2024 05:34:43 +0200 Subject: [PATCH] Update README.md (#278) Added an alternative way of dealing with file saving in Frontend Libraries --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index dc80dfb..71894e3 100644 --- a/README.md +++ b/README.md @@ -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`); + +*/ }) ```