fs-extender
Version:
Extras suite for node fs module
42 lines (41 loc) • 1.72 kB
TypeScript
/// <reference types="node" />
import * as fs from "../../patch";
import * as util from "../util";
/**
* ensureSymlink - ensures symlink existence on file system
*
* ```js
* import * as fs from "fs-extender"
* fs.ensureSymlink(src, dst,(err)=>{
* if(!err) {
* console.log(`Symlink is ensured in the file system.`);
* }
* });
* ```
*
* @param srcPath - the source path of the symlink
* @param dstPath - the destination path to the symlink
* @param options - used to create the symlink or modify it, options can be
* - `type` - the type of the symlink
* @param callback - `(err: Error | null, dstPath: fs.PathLike)`
*/
export declare function ensureSymlink(srcPath: fs.PathLike, dstPath: fs.PathLike, options: util.EnsureOptionsSymlink, callback: (err: NodeJS.ErrnoException, dstPath?: fs.PathLike) => void): void;
export declare function ensureSymlink(srcPath: fs.PathLike, dstPath: fs.PathLike, callback: (err: NodeJS.ErrnoException, dstPath?: fs.PathLike) => void): void;
export declare namespace promises {
/**
* ensureSymlink - ensures symlink existence on file system
*
* ```js
* import * as fs from "fs-extender"
* await fs.promises.ensureSymlink(src, dst);
* console.log(`Symlink is ensured in the file system.`);
* ```
*
* @param srcPath - the source path of the symlink
* @param dstPath - the destination path to the symlink
* @param options - used to create the symlink or modify it, options can be
* - `type` - the type of the symlink
* @return `Promise<dstPath: fs.PathLike>`
*/
function ensureSymlink(srcPath: fs.PathLike, dstPath: fs.PathLike, options?: util.EnsureOptionsSymlink): Promise<fs.PathLike>;
}