Skip to content

Commit

Permalink
feat(fs/walk): add symlink 'destination' to WalkEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
joehillen committed Jan 5, 2024
1 parent 0bffb2e commit c7fad4e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/_create_walk_entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { toPathString } from "./_to_path_string.ts";
export interface WalkEntry extends Deno.DirEntry {
/** Full path of the entry. */
path: string;
/** The target if it is a symbolic link */
destination?: string;
}

/** Create {@linkcode WalkEntry} for the `path` synchronously. */
Expand All @@ -26,6 +28,7 @@ export function createWalkEntrySync(path: string | URL): WalkEntry {
isFile: info.isFile,
isDirectory: info.isDirectory,
isSymlink: info.isSymlink,
destination: info.isSymlink ? Deno.readLinkSync(path) : undefined,
};
}

Expand All @@ -41,5 +44,6 @@ export async function createWalkEntry(path: string | URL): Promise<WalkEntry> {
isFile: info.isFile,
isDirectory: info.isDirectory,
isSymlink: info.isSymlink,
destination: info.isSymlink ? Deno.readLinkSync(path) : undefined,
};
}

0 comments on commit c7fad4e

Please sign in to comment.