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

nativescript-dna-deviceinfo

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-dna-deviceinfo - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "nativescript-dna-deviceinfo",
"version": "1.0.0",
"version": "1.0.1",
"description": "NativeScript plugin to acquire device information.",

@@ -5,0 +5,0 @@ "main": "deviceinfo",

@@ -114,4 +114,41 @@

## APIs in Action
```javascript
printDeviceInfo() {
console.log("Free memory: ", formatBytes(DeviceInfo.freeMemory()));
console.log("Total memory: ", formatBytes(DeviceInfo.totalMemory()));
console.log("Total storage space: ", formatBytes(DeviceInfo.totalStorageSpace()));
console.log("Free storage space: ",formatBytes(DeviceInfo.freeStorageSpace()));
console.log("Device id: ", DeviceInfo.deviceId());
console.log("Device name: ", DeviceInfo.deviceName());
console.log("Device locale: ", DeviceInfo.deviceLocale());
console.log("Device country: ", DeviceInfo.deviceCountry());
console.log("Device timezone: ", DeviceInfo.timezone());
console.log("Device user agent: ", DeviceInfo.userAgent());
console.log("App name: ", DeviceInfo.appName());
console.log("App version: ", DeviceInfo.appVersion());
console.log("App bundle id: ", DeviceInfo.bundleId());
console.log("App bundle number: ", DeviceInfo.bundleNumber());
console.log("System manufacturer: ", DeviceInfo.systemManufacturer());
console.log("Is tablet: ", DeviceInfo.isTablet());
console.log("Is 24 hour: ", DeviceInfo.is24Hour());
console.log("Is emulator: ", DeviceInfo.isEmulator());
}
formatBytes(bytes, decimals) {
if (bytes === 0) return '0 GB'
if (isNaN(parseInt(bytes))) return bytes
if (typeof bytes === 'string') bytes = parseInt(bytes)
if (bytes === 0) return '0';
const k = 1000;
const dm = decimals + 1 || 3;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
}
```
## License
MIT license (see LICENSE file)
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