简体   繁体   中英

How to create a local directory using Electron

I am pretty new with electron. Can anyone suggest me how to create a local folder using the electron. I see JavaScript does not have that capability.

The file system module ( fs ) is also available in electron. You can use mkdir to create a directory:

var fs = require('fs');

// Without checking if dir already exists
fs.mkdir('PATH/TO/DIR');

// With checking if dir already exists
if (!fs.existsSync('PATH/TO/DIR')) fs.mkdir('PATH/TO/DIR');

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM