@weintek/libc/unistd
The @weintek/libc/unistd module provides access to the POSIX operating system API.
Influenced by the C standard library.
Note: Available when a Custom Model script runs on a local HMI.
Import
js
const cunistd = await import('@weintek/libc/unistd');Functions
fsync(fd)
Flushes all modified in-core data of the file to the disk device. Blocks until the device reports the transfer is complete.
See the Linux manual page.
| Name | Type | Description |
|---|---|---|
fd | Number | File descriptor of the file to flush. |
Returns: Number — 0 on success, -1 on error. Use getErrno() to identify the error.
unlink(disk, filename)
Deletes a name from the filesystem. If it was the last link to a file and no processes have it open, the file is deleted and its space is freed.
See the Linux manual page.
| Name | Type | Description |
|---|---|---|
disk | String | Target disk: SD, USB1, or USB2. |
filename | String | File path to delete. |
Returns: Number — 0 on success, -1 on error. Use getErrno() to identify the error.