Path.isFile() method
pathlib-ts > Path > isFile
Path.isFile() method
Section titled “Path.isFile() method”Resolves to true when the path points to a regular file (also true for symlinks pointing to regular files).
Signature:
isFile(options?: { followSymlinks?: boolean; }): Promise<boolean>;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
options |
{ followSymlinks?: boolean; } |
(Optional) Optional follow-symlink toggle. |
Returns:
Promise<boolean>
Promise resolving to true when the path is a regular file.
Remarks
Section titled “Remarks”Follows symlinks by default; pass followSymlinks: false to interrogate the link itself.
Example
Section titled “Example”Skipping non-files during ingestion
import { Path } from "pathlib-ts";
const uploads = new Path("./uploads");for (const entry of await uploads.iterdir()) { if (await entry.isFile()) { console.log("processing", entry.name); }}