write(fd: number, buf: Buffer): number;
fd
- file descriptorbuf
- Buffer with data to write
Writes data from buffer buf
to file descriptor fd
.
Returns number of bytes writte on success, or a negative error number.
Write to console
const STDOUT = 1;
const buf = Buffer.from('Hello world!\n');
libjs.write(STDOUT, buf);