symlink
Creates a symbolic link.
Example
ts
import { SF } from "@duplojs/server-utils";
const result = await SF.symlink("/tmp/target", "/tmp/link");
// result: E.Ok | SF.FileSystemLeft
await SF.symlink("/tmp/target", "/tmp/link-file", { type: "file" });Syntax
typescript
function symlink(
oldPath: string | URL,
newPath: string | URL,
params?: {
type: "file" | "dir" | "junction";
}
): Promise<FileSystemLeft | E.Ok>Parameters
oldPath: link target path.newPath: path of the link to create.params.type: link type (Windows only).
Return value
E.Ok: if creation succeeds.FileSystemLeft: if creation fails.
Notes
- On Windows,
typecan be"file","dir", or"junction".
