Skip to content

brajjan79/FileSize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java CI with Maven Codacy Badge Codacy Badge JitPack

FileSize

FileSize is a small JAVA plugin that provides a fast and easy way to get the size of a file in the format that is needed.

Note if file is not found will return a 0.0 double value.

When sizing up a file you can convert the size to:

  • Bytes
  • KiloBytes
  • MegaBytes
  • GigaBytes
  • GigaBytes
  • TeraBytes
  • PetaBytes
  • ExaBytes
  • ZettaBytes
  • YottaBytes

Installation

The plugin is available in JitPack. https://jitpack.io/#brajjan79/FileSize

Usage

Imports:

import java.io.File;
import com.github.filesize.FileSize;

Code:

File someFile = new File("some path to file");

// Non static way
FileSize fileSize = new FileSize(someFile);

double bytes = fileSize.getBytes();
double KiloBytes = fileSize.getKiloBytes();
// This goes on up to YotaBytes

// Static way Deprecated
double bytes = FileSize.size(someFile).getBytes();
double KiloBytes = FileSize.size(someFile).getKiloBytes();

double bytes = FileSize.getBytes(someFile);
double KiloBytes = FileSize.getKiloBytes(someFile);
// This goes on up to YotaBytes

About

Simple and easy way to get the size of a file or size of content in a folder.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages