Skip to content

linkStat

Retrieves information about a symbolic link (the link itself, not the target).

Example

ts
import { 
SF
} from "@duplojs/server-utils";
import {
E
,
unwrap
} from "@duplojs/utils";
const
info
= await
SF
.
linkStat
("/tmp/link");
// info: E.Success<SF.StatInfo> | SF.FileSystemLeft if (
E
.
isRight
(
info
)) {
const
metadata
=
unwrap
(
info
);
// metadata.isSymlink: boolean }

Syntax

typescript
function linkStat(
  path: string | URL
): Promise<FileSystemLeft | E.Success<StatInfo>>

Interface StatInfo

typescript
interface StatInfo {
  isFile: boolean;
  isDirectory: boolean;
  isSymlink: boolean;
  sizeBytes: number;
  modifiedAt: D.TheDate | null;
  accessedAt: D.TheDate | null;
  createdAt: D.TheDate | null;
  changedAt: D.TheDate | null;
  deviceId: number;
  inode: number | null;
  permissionsMode: number | null;
  hardLinkCount: number | null;
  ownerUserId: number | null;
  ownerGroupId: number | null;
  specialDeviceId: number | null;
  ioBlockSize: number | null;
  allocatedBlockCount: number | null;
  isBlockDevice: boolean | null;
  isCharacterDevice: boolean | null;
  isFifo: boolean | null;
  isSocket: boolean | null;
}

Parameters

  • path : path of the link to inspect.

Return value

  • E.Success<StatInfo> : information about the link.
  • FileSystemLeft : if the read fails.

Notes

See also

  • stat - Retrieves information about a path.

Released under the MIT license.