Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

dont use the deprecable path.exists

  • Loading branch information...
commit 199dcff2c706c84d280321ee190ffac1f2f995f2 1 parent cb2503a
Christopher Jeffrey chjj authored

Showing 1 changed file with 10 additions and 5 deletions. Show diff stats Hide diff stats

  1. +10 5 test/index.js
15 test/index.js
@@ -4,17 +4,22 @@ var parted = require('../')
4 4 , path = require('path');
5 5
6 6 var test = fs.readFileSync(__dirname + '/test.txt');
7   -var boundary = test.toString('utf8')
8   - .match(/^--[^\r\n]+/)[0].slice(2);
  7 +
  8 +var boundary = test
  9 + .toString('utf8')
  10 + .match(/^--[^\r\n]+/)[0]
  11 + .slice(2);
9 12
10 13 var files = path.normalize(__dirname + '/tmp');
11   -if (!path.existsSync(files)) {
12   - fs.mkdirSync(files, 0666);
13   -} else {
  14 +
  15 +try {
14 16 fs.readdirSync(files).forEach(function(f) {
15 17 fs.unlink(files + '/' + f);
16 18 });
  19 +} catch(e) {
  20 + fs.mkdirSync(files);
17 21 }
  22 +
18 23 parted.root = files;
19 24
20 25 // create a mock request

0 comments on commit 199dcff

Please sign in to comment.
Something went wrong with that request. Please try again.