# path-type **Repository Path**: mirrors_sindresorhus/path-type ## Basic Information - **Project Name**: path-type - **Description**: Check if a path is a file, directory, or symlink - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-19 - **Last Updated**: 2026-05-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # path-type > Check if a path is a file, directory, or symlink > [!TIP] > You may not need this package. Node.js provides the same functionality natively via [`fs.stat`](https://nodejs.org/api/fs.html#fspromisesstatpath-options) (e.g., `(await stat(path)).isFile()`). ## Install ```sh npm install path-type ``` ## Usage ```js import {isFile} from 'path-type'; console.log(await isFile('package.json')); //=> true ``` ## API ### isFile(path) Check whether the passed `path` is a file. Returns a `Promise`. #### path Type: `string` The path to check. ### isDirectory(path) Check whether the passed `path` is a directory. Returns a `Promise`. ### isSymlink(path) Check whether the passed `path` is a symlink. Returns a `Promise`. ### isFileSync(path) Synchronously check whether the passed `path` is a file. Returns a `boolean`. ### isDirectorySync(path) Synchronously check whether the passed `path` is a directory. Returns a `boolean`. ### isSymlinkSync(path) Synchronously check whether the passed `path` is a symlink. Returns a `boolean`.