1

i have tried using fs module but I couldn't use this module in my project

const fs = require('fs');
import * as fs from ('fs')

None of the above commands don't work

kalehmann
  • 4,821
  • 6
  • 26
  • 36
msh65
  • 13
  • 5

2 Answers2

0

You can use file saver or the solution here. You can't use node.js modules on the SPA.

If you want to do that, you need to create an API and save on the server side.

You can in cases use node modules as described in this SO question, but the browser will not allow to access the file system as you intend to do with th fs module.

Athanasios Kataras
  • 25,191
  • 4
  • 32
  • 61
0

fs module is node module and You can't use it on the client-side. I suggest you use this Save JSON string