Skip to content

anio-node-foundation/fs-get-path-type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@anio-fs/path-type

Determine the type of a path.

Type Return value
Regular File file
Regular Directory dir
Link to a file link->file
Link to a directory link->dir
Dangling link link->broken
Non existing path false
import fs from "node:fs"
import {getTypeOfPath} from "@anio-fs/path-type"

const entries = fs.readdirSync("examples/files")

for (const entry of entries) {
	console.log(entry, await getTypeOfPath("examples", "files", entry))
}

console.log(await getTypeOfPath("/non/existing/path"))