🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More →
Socket
Book a DemoSign in
Socket

@type-any/react-native-clear-cache

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@type-any/react-native-clear-cache

This library is clear app cache for react native.

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
2
Created
Source

react-native-clear-cache

This library is clear app cache for react native.

Installation

npm install @type-any/react-native-clear-cache

Usage

import ClearCache, { formatFileSize } from '@type-any/react-native-clear-cache';

// ...

// This method will return byte size
const cacheDirSize = await ClearCache.getCacheDirSize();

// Convert byte size to read easy
// second parameter is used to truncate digits, default value is 4
const format = formatFileSize(cacheDirSize);

// file size symbol example
formatFileSize(422); // 422 Bytes
formatFileSize(122304); // 119.4375 KB
formatFileSize(10000000); // 9.5367 MB
formatFileSize(87919837478); // 81.8817 GB
formatFileSize(191238495867681); // 173.9304 TB
formatFileSize(929292929384748571); // 825.3779 PB
formatFileSize(9292929293847485728); // 8.0603 EB
formatFileSize(9292929293847485719928); // 7.8714 ZB
formatFileSize(13847885919183748857185858); // 11.4547 YB

// truncate digits example
formatFileSize(122304); // 119.4375 KB
formatFileSize(122304, 2); // 119.44 KB

// Clear cacheDir
// On Android, will clear both inteinternalCacheDir and externalCacheDir
await ClearCache.clearCacheDir();

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Keywords

react-native

FAQs

Package last updated on 20 May 2021

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