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
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.
fs module is node module and You can't use it on the client-side. I suggest you use this Save JSON string
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.