time-to-botec/js/node_modules/@stdlib/fs/unlink/docs/repl.txt

63 lines
1.7 KiB
Plaintext
Raw Normal View History

{{alias}}( path, clbk )
Asynchronously removes a directory entry.
If a provided path is a symbolic link, the function removes the symbolic
link named by the path and does not affect any file or directory named by
the contents of the symbolic link.
Otherwise, the function removes the link named by the provided path and
decrements the link count of the file referenced by the link.
When a file's link count becomes 0 and no process has the file open, the
space occupied by the file is freed and the file is no longer accessible.
If one or more processes have the file open when the last link is removed,
the link is removed before the function returns; however, the removal of
file contents is postponed until all references to the file are closed.
If the path refers to a socket, FIFO, or device, processes which have the
object open may continue to use it.
The path argument should *not* be a directory. To remove a directory, use
rmdir().
Parameters
----------
path: string|Buffer|integer
Entry path.
clbk: Function
Callback to invoke upon removing an entry.
Examples
--------
> function done( error ) {
... if ( error ) {
... console.error( error.message );
... }
... };
> {{alias}}( './beep/boop.txt', done );
{{alias}}.sync( path )
Synchronously removes a directory entry.
Parameters
----------
path: string|Buffer|integer
Entry path.
Returns
-------
out: Error|null
Error object or null.
Examples
--------
> var out = {{alias}}.sync( './beep/boop.txt' );
See Also
--------