Created
November 5, 2019 08:48
-
-
Save LekoArts/a4ece3918bf452fa1be882d712938a4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const spawn = require('cross-spawn') | |
/** | |
* GetLastUpdatedTimestamp - Get the last time a file was commited to GitHub and therefore was updated | |
* @param filepath | |
* @returns {number} - Date | |
*/ | |
const getLastUpdatedTimestamp = filepath => | |
parseInt(spawn.sync('git', ['log', '-1', '--format=%ct', filepath]).stdout.toString('utf-8'), 10) * 1000 | |
module.exports = getLastUpdatedTimestamp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment