Function overview
Prototype
Byte Converter (
bytes )
Parameters
bytes
Description
Tags:
byte converter, byte, file size, bit converter
This function will takes a integer of a number of bytes fed to it and turn it into a readable human format. Fixed the output.
Examples
Sample input
1678480
Sample output
1.68 MB
Function code
Let(
[
$symbols = "B¶KB¶MB¶GB¶TB¶PB";
$exp = If(bytes; Floor(Log(bytes) / Log(1024)) ; 0)
];
Round( (bytes / 1024^Floor($exp)) ; 2) & " " & GetValue ( $symbols ; $exp + 1)
)
// ===================================
/*
This function is published on FileMaker Custom Functions
to check for updates and provide feedback and bug reports
please visit http://www.fmfunctions.com/fid/211
Prototype: Byte Converter( bytes )
Function Author: Delta Tango (http://www.fmfunctions.com/mid/164)
Last updated: 09 March 2009
Version: 1.1
*/
// ===================================
Let(__LITBR__[__LITBR__$symbols = "B¶KB¶MB¶GB¶TB¶PB";__LITBR__$exp = If(bytes; Floor(Log(bytes) / Log(1024)) ; 0)__LITBR__];__LITBR____LITBR__Round( (bytes / 1024^Floor($exp)) ; 2) & " " & GetValue ( $symbols ; $exp + 1)__LITBR____LITBR__)__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/211__LITBR____LITBR__ Prototype: Byte Converter( bytes )__LITBR__ Function Author: Delta Tango (http://www.fmfunctions.com/mid/164)__LITBR__ Last updated: 09 March 2009__LITBR__ Version: 1.1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.
Comments
09 March 2009
09 March 2009