Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

community-cordova-plugin-cpu

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

community-cordova-plugin-cpu

A plugin for full detail for cpu

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

NPM version

community-cordova-plugin-cpu README

I dedicate a considerable amount of my free time to developing and maintaining many cordova plugins for the community (See the list with all my maintained plugins). To help ensure this plugin is kept updated, new features are added and bugfixes are implemented quickly, please donate a couple of dollars (or a little more if you can stretch) as this will help me to afford to dedicate time to its maintenance. Please consider donating if you're using this plugin in an app that makes you money, or if you're asking for new features or priority bug fixes. Thank you!

Overview

The CpuManager is a TypeScript class designed to provide information about the CPU (Central Processing Unit) of a device. This README file aims to provide a detailed description of the code and its usage.

Installation

To use the CpuManager class, you need to install it as a dependency in your project:

cordova plugin add community-cordova-plugin-cpu
  • for now it's Android only

Table of Contents

Introduction

The CpuManager class exports methods to retrieve essential information about the device's CPU, such as architecture, core count, frequency, model, and more. It uses TypeScript and is intended for use in Node.js or other JavaScript environments.

Usage

To utilize the CpuManager class in your project, follow these steps:

  1. Import the CpuManager class into your TypeScript/JavaScript file:
import CpuManager from 'community-cordova-plugin-cpu';
  1. Create an instance of the CpuManager class:
declare var CpuPlugin: CpuManager;
  1. Use the getCpuInfo method to retrieve CPU information asynchronously:
cpuManager.getCpuInfo()
  .then((cpuInfo) => {
    console.log('CPU Information:', cpuInfo);
  })
  .catch((error) => {
    console.error('Error fetching CPU information:', error);
  });

or

var cpuObj = await CpuPlugin.getCpuInfo();

API Reference

CpuManager

getCpuInfo(): Promise<ICpu>

Retrieves detailed information about the device's CPU.

  • Returns: A Promise that resolves to an ICpu object containing the following properties:

    • cpuArchitecture: A string representing the CPU architecture (e.g., ARMv7, ARMv8, x86, x86_64, etc.).
    • cpuCores: The number of CPU cores available on the device.
    • cpuFrequencyMax: The maximum CPU frequency in MHz.
    • cpuFrequencyMin: The minimum CPU frequency in MHz.
    • cpuModel: The CPU model or identifier (number).
    • primaryABI: The primary ABI (Application Binary Interface) used by the CPU.
    • secondaryABI: The secondary ABI (Application Binary Interface) if available.
    • cpuFrequencyInfo: An array of objects containing CPU core-specific information, each with the following properties:
      • coreIndex: The core index or identifier (number).
      • currentFrequency: The current CPU frequency for the core in MHz.

Interfaces

ICpu

An interface describing the CPU information structure:

  • cpuArchitecture (string): CPU architecture, e.g., ARMv7, ARMv8, x86, x86_64, etc.
  • cpuCores (number): Number of CPU cores available on the device.
  • cpuFrequencyMax (string): Maximum CPU frequency in MHz.
  • cpuFrequencyMin (string): Minimum CPU frequency in MHz.
  • cpuModel (number): CPU model or identifier.
  • primaryABI (string): Primary ABI (Application Binary Interface).
  • secondaryABI (string): Secondary ABI (Application Binary Interface) if available.
  • cpuFrequencyInfo (ICpuCores[]): Array of CPU core-specific information.
ICpuCores

An interface describing CPU core-specific information:

  • coreIndex (number): Core index or identifier.
  • currentFrequency (string): Current CPU frequency for the core in MHz.

Contributing

Contributions to this project are welcome. If you encounter issues, have suggestions, or want to contribute improvements, please feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.


Feel free to use the CpuManager class in your projects to retrieve and utilize CPU information effectively. If you have any questions or need assistance, please refer to the Issues section of the GitHub repository for this project.

FAQs

Package last updated on 07 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc