File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
src/FileSizeFromBase64.NET Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -10,28 +10,27 @@ public static class FileSizeHelpers
1010 /// <summary>
1111 /// Calculate a file size from base64 string.
1212 /// </summary>
13- /// <param name="base64String">The base64 string of the file .</param>
13+ /// <param name="base64String">The base64 string.</param>
1414 /// <param name="applyPaddingsRules">Indicate if the padding management is required or not. Default is false</param>
1515 /// <param name="unitsOfMeasurement">The unit of measure of the file size returned by the method. The default unit of measure is Byte.</param>
1616 /// <returns>The size of the file represented by the base64 string.</returns>
1717 public static double GetFileSizeFromBase64String ( string base64String , Boolean applyPaddingsRules = false , UnitsOfMeasurement unitsOfMeasurement = UnitsOfMeasurement . Byte )
1818 {
1919 if ( string . IsNullOrEmpty ( base64String ) ) return 0 ;
2020
21- // Remove MIME type from the base64 if exists
21+ // Remove MIME- type from the base64 if exists
2222 var base64Length = base64String . Contains ( "base64," ) ? base64String . Split ( ',' ) [ 1 ] . Length : base64String . Length ;
2323
2424 var fileSizeInBytes = Math . Ceiling ( ( double ) base64Length / 4 ) * 3 ;
2525
26- if ( applyPaddingsRules && base64Length >= 2 )
26+ if ( applyPaddingsRules && base64Length >= 2 )
2727 {
2828 var paddings = base64String [ ^ 2 ..] ;
2929 fileSizeInBytes = paddings . Equals ( "==" ) ? fileSizeInBytes - 2 : paddings [ 1 ] . Equals ( "=" ) ? fileSizeInBytes - 1 : fileSizeInBytes ;
3030 }
3131
3232 return ( fileSizeInBytes > 0 ) ? fileSizeInBytes / ( int ) unitsOfMeasurement : 0 ;
3333 }
34-
3534 }
3635
3736 /// <summary>
You can’t perform that action at this time.
0 commit comments