How can the fs module of Node be called in the html file

currently there are only two files. Packaging node into exe executable files requires node-webkit;

there are basically two files on the Internet, but the problem is how to call the fs module require in html doesn"t seem to work!

clipboard.png

want to call node"s fs module in app.html.

Mar.18,2021

Sorry, fs can only be called in the context of node. Html is a static file, which needs to be parsed by the browser, so there is no way for the time being.


  1. HTML cannot call Node's fs module because there is no node environment in the browser, and you are not allowed to use the node environment
  2. if you want to do desktop applications, it's possible to use node-webkit, but I haven't done it. I have used Electron, to send a request to the main process using the rendering process, and then return it to the rendering process after the operation of the main process. It is recommended to read the document carefully, or combine the corresponding keywords to search, but your question itself is wrong.

to package exe, with node, you can consider electron


one is a static file, the other is a server program, and the latter can operate the former at will, and vice versa.

Menu