Saving files locally with electron

后端 未结 3 1861
深忆病人
深忆病人 2020-11-30 23:32

I have some template files that contain a few variable strings each, I\'d like to build a very simple input form with Electron (http://electron.atom.io/) and I want to save

3条回答
  •  时光取名叫无心
    2020-11-30 23:54

    If you are targeting multiple platforms, I answered a similar question here. Basically app.getPath(name), app.setPath(name, path), and app.getAppPath() are very useful in saving files to the the right place regardless of the OS.

    You may also want to check out these Nodejs packages which help simplify saving files directly to the host machine...

    • fs-jetpack
    • graceful-fs
    • Node.js fs

    If you intend for users to save files you might also have a look at the Dialog api where you can specifically invoke a save dialog for that purpose.

提交回复
热议问题