content-delete

Delete everything inside a folder, but leave the folder.

Usage no npm install needed!

<script type="module">
  import contentDelete from 'https://cdn.skypack.dev/content-delete';
</script>

README

Content Delete

Delete contents of a folder, but not the folder.

Command Line Usage

Given a folder tmp, the command

node content-delete tmp

removes everything from inside the folder, but leaves the folder itself.

Usage in Node

var condel = require('content-delete');

condel('test', function(err, count) {
  // err.list is an array of any errors that occurred
  // err.successCount is the number of items deleted from the folder
  if(err) {
    return console.log(err);
  }

  // count is the number of items deleted from the folder
  console.log('Deleted', count, 'items');
});

Development

Get the code:

git clone https://github.com/msrose/content-delete.git
cd content-delete
npm install

Run the tests:

npm test