touchp

mkdir -p meets touch

Usage no npm install needed!

<script type="module">
  import touchp from 'https://cdn.skypack.dev/touchp';
</script>

README

touchp

Like mkdir -p, but with touch

Install

npm install touchp

Usage

var touchp = require('touchp');

touchp('some/path/that/may/not/exist.txt', function(err, alreadyExisted) {
  console.log("File " + (alreadyExisted ? 'already exists' : 'was created'));
});

var existedBefore = touchp.sync('some/other/path/that/may/not/exist.txt')