🌳
pt0/serverF/libFs/lsFilesPathsRecF.mts
1import * as _ from 'lodash-es'
2import { promisify } from 'util'
3import fs from 'fs'
5export const readdir = promisify(fs.readdir)
7export const getFilename = (path: string, sep='/') => {
8 const splitA = _.split(path, sep)
9 if (splitA.length <= 1) return
10 return _.last(splitA)
13export const getExt = (path: string) => getFilename(path, '.')
15export const isDir = (path: string) => {
16 return fs.existsSync(path) && fs.lstatSync(path).isDirectory()