Skip to content

Schedule deleting all file in a directory in X time after their creation.

Notifications You must be signed in to change notification settings

SharifPoetra/node-crond

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-crond

Schedule deleting all file in a directory in X time after their creation.

discord-server npm-version npm-downloads npm-dependencies GitHub repo size GitHub package.json version

Installation

npm install node-crond --save

Options

  • dir String - The path to directory
  • timeInMs Number - The time in miliseconds to delete the file after their time creation
  • debug Boolean - Log the deleted file to console

Example usage

const CronD = require("node-crond");

// intialize crond to delete all files in ./path/to/dir directory with 120000ms (2 minutes) after the file creation time
const crond = new CronD({ dir: "./path/to/dir", timeInMs: 120000 });

// start the check (remember that crond already have the interval to check set to 5 seconds so you do not need to do the interval again yourself)
crond.init();

// clear the interval
crond.cancel();

About

Schedule deleting all file in a directory in X time after their creation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published