https://github.com/davidfig/file-older-than
node.js: checks if a file modify date is older than a duration (useful for cache checks)
https://github.com/davidfig/file-older-than
Last synced: about 2 months ago
JSON representation
node.js: checks if a file modify date is older than a duration (useful for cache checks)
- Host: GitHub
- URL: https://github.com/davidfig/file-older-than
- Owner: davidfig
- License: mit
- Created: 2017-07-30T16:12:32.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-30T16:15:50.000Z (almost 9 years ago)
- Last Synced: 2025-10-10T03:26:55.613Z (8 months ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## file-older-than.js
node.js: checks if a file modify date is older than a duration (useful for cache checks)
## Code Example
const FileOlderThan = require('file-older-than')
if (FileOlderThan('test-file', '1h5m'))
{
console.log('File is older than 1 hour, 5 minutes')
}
else
{
console.log('File is younger than 1 hour, 5 minutes')
}
## Installation
npm i file-older-than
## API Reference
/**
* returns whether a file is older than a certain duration
* @param {string} filename
* @param {string} duration - see https://github.com/icholy/Duration.js (e.g., '5m', '20w', '300d30h10m5s')
* @return {boolean} true = file is older than the duration OR file does not exist
*/
function FileOlderThan(file, duration)
## Tests
npm install
npm run test
* * *
Copyright (c) 2017 YOPEY YOPEY LLC - MIT License