Skip to content

Instantly share code, notes, and snippets.

@roatnek
Last active April 20, 2017 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roatnek/d45e82642bc12cb74dc2e4c34571cf05 to your computer and use it in GitHub Desktop.
Save roatnek/d45e82642bc12cb74dc2e4c34571cf05 to your computer and use it in GitHub Desktop.
// Node.js
var fs = require('fs');
function func() {
try {
fs.statSync('./foo/');
// operate files in the directory foo
} catch(error) {
fs.mkdirSync('./foo/');
func();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment