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

1
  • client side you don't have nodejs (thats where the fs comes from) Commented Nov 10, 2019 at 10:25

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

9 Comments

Can the project be stored inside for reuse?
What do you mean? Inside where?
inside myproject
Can I recover with this module data json stored again?
If you save with an api, then yes, you can retrieve by the api. The save file module still just save in the file system and won't be retrievable by the app
|
0

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

3 Comments

i wanna use in angular help me
Can the project be stored inside for reuse?
Did you see the link I posted above?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.