Quark #

Modules #

Quark v1.4.0 Documentation

Contents

quark/os #

Enum: NetworkInterface #

NetworkInterface #

  • kNone None
  • kETH Ethernet
  • kMobile Mobile
  • k2G Mobile 2G
  • k3G Mobile 3G
  • k4G Mobile 4G
  • k5G Mobile 5G

arch() #

Get CPU architecture type of the current device. Possible values:

  • "arm64" 64-bit ARM architecture
  • "x64" 64-bit x86 architecture
  • "arm" 32-bit ARM architecture
  • "x86" 32-bit x86 architecture
  • "mips" 32-bit MIPS architecture
  • "mips64" 64-bit MIPS architecture Notes:
    • The returned value reflects the runtime CPU architecture, not the ABI or instruction set availability.
    • On emulators or compatibility layers, the value may differ from the physical hardware.
      arch(): |

name() #

Get operating system name. Possible values:

  • "Android"
  • "iOS"
  • "MacOSX"
  • "Linux" Notes:
    • The returned value represents the operating system family, not a specific distribution or version.
    • For Apple platforms, iOS and macOS are reported separately.
      name(): |

version() #

Get operating system version information. Platform-specific behavior:

  • iOS / macOS: Returns the system version string. Example:
    • "17.1.2"
    • "14.2"
  • Android: Returns the Android OS version. Example:
    • "14"
    • "13"
  • Linux: Returns the kernel release version. Example:
    • "6.6.12-arch1-1"
    • "5.15.0-89-generic" Notes:
  • The format of the returned string is platform-dependent.
  • This value is intended for informational and compatibility checks, not strict semantic version comparison.
    version(): string

brand() #

Get device or operating system brand. Platform-specific behavior:

  • Apple platforms (iOS / macOS): Returns "Apple".
  • Android: Returns the device manufacturer. Examples:
    • "google"
    • "samsung"
    • "Xiaomi"
    • "HUAWEI"
    • "OPPO"
    • "vivo"
    • "OnePlus"
  • Linux: Returns the distribution name if available. Examples:
    • "Ubuntu"
    • "Arch Linux"
    • "Debian GNU/Linux" Notes:
  • On some platforms or environments, this value may be empty or unavailable.
  • The returned string should be treated as informational only.
    brand(): string

model() #

Get device model / platform model identifier. Platform-specific behavior:

  • iOS: Returns device family name. Possible values:
    • "iPhone"
    • "iPad"
    • "iPod touch"
  • macOS: Returns Apple hardware model identifier. Example:
    • "Mac16,10"
  • Android: Returns OEM device model string (Build.MODEL). Examples:
    • "Pixel 7"
    • "Pixel 8 Pro"
    • "SM-S9110"
    • "2304FPN6DC"
    • "ALN-AL00"
    • "sdk_gphone64_arm64" (emulator)
  • Linux: No standard device model exists. Returns an empty string. Notes:
  • The returned value is platform-dependent and not guaranteed to be comparable across different operating systems.
  • This API is intended for identification, logging, and platform-specific behavior selection, not for strict device classification.
    model(): 

info() #

Get OS information

info(): string

For example:

// Prints:
// sysname: Louis-iPhone
// sysname: Darwin
// machine: iPhone7,2
// nodename: Louis-iPhone
// version: Darwin Kernel Version 16.6.0: Mon Apr 17 17:33:35 PDT 2017; root:xnu-3789.60.24~24/RELEASE_ARM64_T7000
// release: 16.6.0
console.log(os.info());

languages() #

Get List of OS supported languages, May value is 'en-us'|'zh-cn'|'zh-tw'

languages(): string[]

isWifi() #

Is it a wifi network type?

isWifi(): boolean

isMobile() #

Is it a mobile network type?

isMobile(): boolean

networkInterface() #

Get the network interface

networkInterface(): NetworkInterface

isAcPower() #

Is there an external power supply connected?

isAcPower(): boolean

isBattery() #

Is there a battery device?

isBattery(): boolean

batteryLevel() #

Get battery power percentage if have a battery

batteryLevel(): number

Returns: range 0 to 1

memory() #

Get the memory total

memory(): number

usedMemory() #

Get the used memory size

usedMemory(): number

availableMemory() #

Get the available memory size

availableMemory(): number

cpuUsage() #

Get CPU usage percentage

cpuUsage(): number