简体   繁体   中英

How to create new local folder/directory in javascript

I want to create new folder locally using javascript in firefox browser. Following piece of code I tried, but no sucess.

var dir = new Dir(rcDirUrl); //doesnt work
dir.create(dir.DIRECTORY_TYPE, 0775);

Can anyone help out how to create directory in javascript.

if you're executing the JS in the browser - you cannot do it. Browser-based JS doesn't have access to the hard drive at all. You won't open anything (unless file is provided through file selector in HTML) and you won't store anything.

If you're using Node.js, you can do it with fs.mkdir() or fs.mkdirSync() - https://nodejs.org/api/fs.html#fs_fs_mkdirsync_path_mode

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