0.5.1 • Published 2 years ago

cached-commit-date v0.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

A npm package to get the latest commit date for a given file path. As getting the commit date is a time consuming step (like 100 ms) those dates are cached so that subsequent queries for a commit date of the same file path would use the cache. I´m using it in my 11ty-powered website to show a posts date of modification.

Install

npm i cached-commit-date

Usage

const ccd = require('cached-commit-date');

//will return a date or null
let date = ccd.commitDate('./2020-07-04-learn-eleventy-from-scratch.md'); //2021-05-23T10:01:41.000Z
//if the file doesn´t exist or is not under git control 
//will return null and not throw an exception 

Clearing the cache

ccd.clearCache();

Configuration

There is no configuration.

0.5.1

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago