react-native-ram
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

react-native-ram

A react-native module to get device RAM

Installation

Using npm:

npm install react-native-ram

or using yarn:

yarn add react-native-ram

Usage

import { getAllRamInfo } from "react-native-ram";

React.useEffect(()=>{
   getAllRamInfo().then(( ramInfo )=> console.log(ramInfo))
},[])


#### OR use async/await

const getRam=async()=>{
 const ramInfo = await getAllRamInfo();
 console.log(ramInfo)
}

// ...result example in MB and %

{
  "appUsedMemory": 12.637718200683594,
  "percentageUsed": 48.736824388734746,
  "usedMemory": 2726.0390625,
  "availableMemory": 2867.34765625,
  "totalMemory": 5593.38671875,
  "percentageAvailable": 51.263175611265254
}

API

Method Return Type iOS Android
getAllRamInfo() Promise<RamState>
getTotalRam() Promise<number>
getUsedRam() Promise<number>
getAvailableRam() Promise<number>
getPercentageUsed() Promise<number>
getPercentageAvailable() Promise<number>
getAppRamUsed() Promise<number>

Type

interface RamState {
  percentageAvailable: number;
  percentageUsed: number;
  totalMemory: number;
  availableMemory: number;
  usedMemory: number;
  appUsedMemory?: number;
}

License

MIT


Package Sidebar

Install

npm i react-native-ram

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

101 kB

Total Files

51

Last publish

Collaborators

  • uniqqum