@weintek/libc/unistd

The @weintek/libc/unistd module provides access to the POSIX operating system API.

  • The modules under @weintek/libc (e.g., errno, stdio, string, unistd) are heavily influenced by the design of C standard library.

Methods

(static) fsync(fd) → {Number}

Since:
  • EasyBuilder Pro V6.09.01
See:

This method flushes all modified in-core data of the file referred to by the file descriptor fd to the disk device so that all changed information can be retrieved even if the system is rebooted. This includes writing through or flushing a disk cache if present. The call blocks until the device reports that the transfer has completed.

Parameters:
Name Type Description
fd Number

The file descriptor referring to the file to be flushed.

Returns:

Returns zero on success. Returns -1 on error, and getErrno can be used to identify the error.

Type
Number
Since:
  • EasyBuilder Pro V6.09.01
See:

This method deletes a name from the filesystem. If that name was the last link to a file and no processes have the file open, the file is deleted and the space it was using is made available for reuse.

Parameters:
Name Type Description
disk String

A string specifies the target disk. Acceptable values are SD, USB1 and USB2.

filename String

A string specifies the file path.

Returns:

Returns zero on success. Returns -1 on error, and getErrno can be used to identify the error.

Type
Number