Skip to content

k13-engineering/node-po6-ioctl

Repository files navigation

node-po6-ioctl

A lightweight Node.js wrapper for the ioctl system call using NAPI.

Installation

npm install @k13engineering/po6-ioctl

Usage

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);
}

API

ioctl({ fd, request, arg })

  • fd (number): File descriptor
  • request (bigint): ioctl request code
  • arg (bigint | Uint8Array): Argument to pass to ioctl

Returns an object with either:

  • { errno: number, ret: undefined } on error
  • { errno: undefined, ret: bigint } on success

License

See LICENSE file.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published