Event ‣ rmdir - chung-leong/zigar GitHub Wiki
Occurs when a system call is made to remove a directory.
Usage
const std = @import("std");
pub const rmdir = std.posix.rmdir;
import { __zigar, rmdir } from './event-rmdir-example-1.zig';
const { on } = __zigar;
on('rmdir', (evt) => {
console.log(evt);
return true;
})
rmdir('/var/mushroom/kingdom');
{ parent: null, path: 'var/mushroom/kingdom' }
Event fields:
parent:object
The parent directory, if the event is triggered by a call to unlinkat() (with theAT_REMOVEDIRflag) or std.fs.Dir.deleteDir(). It'snullwhen an absolute path is used to reference the directory.path:string
Relative path to the directory. No leading slash even when an absolute path is used.
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.