Event ‣ symlink - chung-leong/zigar GitHub Wiki
Occurs when a system call is made to create a symbolic link.
Usage
const std = @import("std");
pub const symlink = std.posix.symlink;
import { __zigar, symlink } from './event-symlink-example-1.zig';
const { on } = __zigar;
on('symlink', (evt) => {
console.log(evt);
return true;
})
symlink('/var/mushroom/kingdom/luigi.txt', '/var/mushroom/kingdom/mario.txt');
{
parent: null,
path: 'var/mushroom/kingdom/mario.txt',
target: '/var/mushroom/kingdom/luigi.txt'
}
Event fields:
parent:object
The parent directory, if the event is triggered by a call to symlinkat() or std.fs.Dir.symLink(). It'snullwhen an absolute path is used to reference the file.path:string
Relative path to the link being created. No leading slash even when an absolute path is used.target:string
Absolute path to the file being linked to.
Return value:
boolean|undefined
true if the operation succeeds or false otherwise. undefined means the listener
declined to handle the event, allowing the operation to be handled by the actual file system.
Note:
The callback function can be async, provided that it's never invoked in the main thread.