Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Compare timestamps of elmi files
/*
This script compares timestamp of elmi files
To try getting files that take a long time to compile
But this attempt has proven very useful
*/
var fs = require("fs")
var path = require("path")
var dir = "./elm-stuff/build-artifacts/0.18.0/Versent/stax/1.0.0/";
var files = fs.readdirSync(dir);
var wantedExtension = ".elmi"
var previousTime = 0
function getFileTime(name) {
return fs.statSync(dir + name).mtime.getTime()
}
files.sort(function(a, b) {
return getFileTime(a) - getFileTime(b);
});
files = files.filter(function(name) {
var ext = path.extname(name)
return ext == wantedExtension
})
files.forEach(function(name) {
var time = getFileTime(name)
var thisTime = time - previousTime
if (thisTime > 800) console.log(name, thisTime)
previousTime = time
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.