//через Node.js
//npm i @types/node
import * as fs from 'fs'
import * as path from 'path'
let filePath = "file.txt"
let stats = fs.statSync(filePath)
//размер файла
let fileSize = stats.size
//дата изменения файла
let dateChanges = stats.mtime
//дата создания файла
let creationDate = stats.birthtime
//можно читать, записывать и выполнять
let canRWE = (stats.mode && fs.constants.S_IRWXU) ===
fs.constants.S_IRWXU
//расширение файла
let extension = path.extname(filePath)
//имя файла
let fileName = path.basename(filePath)
//имя файла без расширения
let fileNameOnly = path.basename(filePath, extension)
//каталог файла
let fileDir = path.dirname(filePath)
console.log("fileSize is", fileSize, "bytes")
console.log("dateChanges is", dateChanges)
console.log("creationDate is", creationDate)
console.log("canRWE is", canRWE)
console.log("extension is", extension)
console.log("fileName is", fileName)
console.log("fileNameOnly is", fileNameOnly)
console.log("fileDir is", fileDir)