fs-extender
Version:
Extras suite for node fs module
36 lines (35 loc) • 1.17 kB
TypeScript
/// <reference types="node" />
import * as fs from "../../patch";
/**
* ensureLink - ensures link existence on file system
*
* ```js
* import * as fs from "fs-extender"
* fs.ensureLink(src, dst,(err)=>{
* if(!err) {
* console.log(`Link is ensured in the file system.`);
* }
* });
* ```
*
* @param srcPath - the source path of the link
* @param dstPath - the destination path to the link
* @param callback - (err: Error | null, dstPath: fs.PathLike)
*/
export declare function ensureLink(srcPath: fs.PathLike, dstPath: fs.PathLike, callback: (err: NodeJS.ErrnoException | null, dstPath?: fs.PathLike) => void): void;
export declare namespace promises {
/**
* ensureLink - ensures link existence on file system
*
* ```js
* import * as fs from "fs-extender"
* await fs.promises.ensureLink(src, dst);
* console.log(`Link is ensured in the file system.`);
* ```
*
* @param srcPath - the source path of the link
* @param dstPath - the destination path to the link
* @return dstPath: fs.PathLike
*/
function ensureLink(srcPath: fs.PathLike, dstPath: fs.PathLike): Promise<fs.PathLike>;
}