Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
227 views
in Technique[技术] by (71.8m points)

javascript - Using node.js's File System functions from a browser

I want to create a function that removes a file from the server. I intend to use this function to restore settings (i.e. db files) to their default state. I run my server using the following command:

node server.js

I am aware of node.js's File System but I don't know how to use it on the browser side. I did some light reading on the issue and it seems to me that this kind of interaction is not possible due to security reasons. How do I go about this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You cannot use Node's fs in the browser and have it directly affect the file system on the server. fs is for use on locally available file systems only. You will need to create an API or use some other technique.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...