0.1.0 • Published 3 years ago

@iqrok/shmop v0.1.0

Weekly downloads
41
License
MIT
Repository
-
Last release
3 years ago

shmop C binding

Usage

const shmop = require('@iqrok/shmop');

Methods

setPath(path)

  • Descriptions set path to generate token with ftok()
  • Parameter(s)
    • path String path to existing file

getToken(id, path = null)

  • Descriptions generate token with ftok()
  • Parameter(s)
    • id Number number from 1 - 255. if 0 is passed as id, it will throw error
    • path (optional) use path defined via this parameter instead of global path defined via setPath()
  • Return Number generated token

read(id, type)

  • Descriptions read shared memory block pointed by the provided token
  • Parameter(s)
    • id Number if id <= 255, then it will be passed to getToken(), otherwise it will be treated as the token
    • type String data type that will be read
  • Return Number Read shared memory

write(id, value, type)

  • Descriptions read shared memory block pointed by the provided token
  • Parameter(s)
    • id Number if id <= 255, then it will be passed to getToken(), otherwise it will be treated as the token
    • value Number value that will be written to shared memory block
    • type String data type that will be read
  • Return Number Read shared memory

Valid Data Types

TypeDescription
uint88-bit unsigned integer
int88-bit signed integer
uint1616-bit unsigned integer
int1616-bit signed integer
uint3232-bit unsigned integer
int3232-bit signed integer
float32-bit single precision floating number
double64-bit double precision floating number