Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

dont use the deprecable path.exists

  • Loading branch information...
commit 199dcff2c706c84d280321ee190ffac1f2f995f2 1 parent cb2503a
@chjj authored
Showing with 10 additions and 5 deletions.
  1. +10 −5 test/index.js
View
15 test/index.js
@@ -4,17 +4,22 @@ var parted = require('../')
, path = require('path');
var test = fs.readFileSync(__dirname + '/test.txt');
-var boundary = test.toString('utf8')
- .match(/^--[^\r\n]+/)[0].slice(2);
+
+var boundary = test
+ .toString('utf8')
+ .match(/^--[^\r\n]+/)[0]
+ .slice(2);
var files = path.normalize(__dirname + '/tmp');
-if (!path.existsSync(files)) {
- fs.mkdirSync(files, 0666);
-} else {
+
+try {
fs.readdirSync(files).forEach(function(f) {
fs.unlink(files + '/' + f);
});
+} catch(e) {
+ fs.mkdirSync(files);
}
+
parted.root = files;
// create a mock request
Please sign in to comment.
Something went wrong with that request. Please try again.