Whisher Whisher - 1 year ago 219
Node.js Question

node how to create a directory if doesn't exist?

I'm wondering if this

var dir = __dirname + '/upload';
if (!path.existsSync(dir)) {

is the right way to create a directory if not
exists with full permission for the script
and readable by others.

Answer Source
var fs = require('fs');
var dir = './tmp';

if (!fs.existsSync(dir)){
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download