From c7fad4e75def950018c20168352e80b1a6f45876 Mon Sep 17 00:00:00 2001 From: Joe Hillenbrand Date: Thu, 4 Jan 2024 23:21:30 -0800 Subject: [PATCH] feat(fs/walk): add symlink 'destination' to WalkEntry --- fs/_create_walk_entry.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/_create_walk_entry.ts b/fs/_create_walk_entry.ts index 655b57635e551..287eb9d71285c 100644 --- a/fs/_create_walk_entry.ts +++ b/fs/_create_walk_entry.ts @@ -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. */ @@ -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, }; } @@ -41,5 +44,6 @@ export async function createWalkEntry(path: string | URL): Promise { isFile: info.isFile, isDirectory: info.isDirectory, isSymlink: info.isSymlink, + destination: info.isSymlink ? Deno.readLinkSync(path) : undefined, }; }