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<"symlink">
await SF.symlink("/tmp/target", "/tmp/link-file", { type: "file" });Syntax
typescript
function symlink(
oldPath: string,
newPath: string,
params?: {
type: "file" | "dir" | "junction";
}
): Promise<FileSystemLeft<"symlink"> | 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<"symlink">: if creation fails.
Notes
- On Windows,
typecan be"file","dir", or"junction".
