posix ioctl
npm install @k13engineering/po6-ioctlA lightweight Node.js wrapper for the ioctl system call using NAPI.
``bash`
npm install @k13engineering/po6-ioctl
`typescript
import { ioctl } from '@k13engineering/po6-ioctl';
const result = ioctl({
fd: fileDescriptor,
request: 0x12345678n, // ioctl request code
arg: buffer // bigint or Uint8Array
});
if (result.errno !== undefined) {
console.error('ioctl failed:', result.errno);
} else {
console.log('ioctl succeeded:', result.ret);
}
`
- fd (number): File descriptorrequest
- (bigint): ioctl request codearg
- (bigint | Uint8Array): Argument to pass to ioctl
Returns an object with either:
- { errno: number, ret: undefined } on error{ errno: undefined, ret: bigint }` on success
-
See LICENSE file.