<commit_before># file-cleaner

file-cleaner is a nodejs module for removing old files periodically.

## Install

```
npm install file-cleaner
```

## Usage

```
var FileCleaner = require('file-cleaner').FileCleaner;

var sessionWatcher = new FileCleaner(__dirname + '/files/', 15 * 60 * 1000,  '*/15 * * * * *', {
  start: true
});
```

## Full example

```
var FileCleaner = require('file-cleaner').FileCleaner;

var sessionWatcher = new FileCleaner(__dirname + '/session_files/', 60 * 60 * 1000,  '00 */15 * * * *', {
  recursive: true,
  timeFiled: 'ctime'
});

sessionWatcher.on('delete', function(file){
  console.log('DELETE');
  console.log(file.name);
  console.log(file.folder);
  console.log(file.path);
});

sessionWatcher.on('error', function(err){
  console.log('ERROR');
  console.error(err);
});

sessionWatcher.on('stop', function(info){
  console.log('STOP');
  console.log(info.path);
  console.log(info.cronTime);
});

sessionWatcher.on('start', function(info){
  console.log('START');
  console.log(info.path);
  console.log(info.cronTime);
});

sessionWatcher.start();
```<commit_msg>Edit README.md<commit_after># file-cleaner

file-cleaner is a nodejs module for removing old files periodically.

## Install

```
npm install file-cleaner
```

## Usage

```
var FileCleaner = require('file-cleaner').FileCleaner;

var sessionWatcher = new FileCleaner(__dirname + '/files/', 15 * 60 * 1000,  '*/15 * * * * *', {
  start: true
});
```

## Full example

```
var FileCleaner = require('file-cleaner').FileCleaner;

var sessionWatcher = new FileCleaner(__dirname + '/session_files/', 60 * 60 * 1000,  '00 */15 * * * *', {
  recursive: true,
  timeFiled: 'ctime'
});

sessionWatcher.on('delete', function(file){
  console.log('DELETE');
  console.log(file.name);
  console.log(file.folder);
  console.log(file.path);
});

sessionWatcher.on('error', function(err){
  console.log('ERROR');
  console.error(err);
});

sessionWatcher.on('stop', function(info){
  console.log('STOP');
  console.log(info.path);
  console.log(info.cronTime);
});

sessionWatcher.on('start', function(info){
  console.log('START');
  console.log(info.path);
  console.log(info.cronTime);
});

sessionWatcher.start();
```

## Tests

```
npm test
```

## Coverage

```
npm run coverage
```

## Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style.
Add tests for any new or changed functionality. Lint and test your code.

## License

MIT
{'fraction_non_alphanumeric': 0.18362383461694365, 'fraction_numerical': 0.01783542764491285, 'mean_word_length': 4.621867881548975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3414530', 'n_tokens_mistral': 908, 'n_tokens_neox': 847, 'n_words': 180}