Skip to content

Unlink

[<Interface>]
type Unlink =
    abstract member Invoke (path: PathLike, callback: NoParamCallback) : unit
    abstract member __promisify__ (path: PathLike) : Promise<unit>
AssemblyXantham.Fable.Node

Methods

abstract member Invoke (path: PathLike, callback: NoParamCallback) : unit

Asynchronously removes a file or symbolic link. No arguments other than a possible exception are given to the completion callback.

import { unlink } from 'node:fs';
// Assuming that 'path/file.txt' is a regular file.
unlink('path/file.txt', (err) => {
if (err) throw err;
console.log('path/file.txt was deleted');
});

fs.unlink() will not work on a directory, empty or otherwise. To remove a directory, use rmdir.

See the POSIX unlink(2) documentation for more details.

@since v0.0.2

abstract member __promisify__ (path: PathLike) : Promise<unit>

Asynchronous unlink(2) - delete a name and possibly the file it refers to.

Parameter
pathA path to a file. If a URL is provided, it must use the file: protocol.