projeto-hit/backend/src/helpers/CreationTime.ts

24 lines
480 B
TypeScript

// require fs module
const fs = require("fs");
// Delete a directory and its children
export const creationTime = (sourcePath: string) => {
if (fs.existsSync(sourcePath)) {
try {
const { birthtime } = fs.statSync(sourcePath)
return birthtime
} catch (error) {
console.log(`There was an error on trying get de file/directory creation info from ${sourcePath}: `, error)
}
}
return
}