info(forFileAt:infoAboutSymbolicLink:)

Returns information about the file at path if it exists; nil otherwise.

FileSystem.swift:283
iOS
13.0+
macOS
10.15+
tvOS
13.0+
watchOS
6.0+
func info(forFileAt path: FilePath, infoAboutSymbolicLink: Bool) async throws -> FileInfo?

Parameters

path

The path of the file.

If the file is a symbolic link and this parameter is true, then information about the link will be returned. Otherwise, information about the destination of the symbolic link is returned.

Returns

Information about the file at the given path or nil if no file exists.

Implementation details

Uses lstat(2) if infoAboutSymbolicLink is true, stat(2) otherwise.