Skip to content

fileSizeFormat

주어진 파일 크기(바이트)를 사람이 읽기 쉬운 문자열로 반환합니다.

Parameters

이름타입필수기본값
bytesnumber
Converts it to a human-friendly string via the bytes provided here.
decimalsnamednumber2
Specifies the number of decimal places to represent.
ceilnamedbooleanfalse
이 값이 true이면 소수점을 제거하고 올림합니다.

named 표시가 있는 파라미터는 Dart에서는 named 파라미터, Python에서는 키워드 인자로 전달됩니다.

Returns

string

Examples

javascript
fileSizeFormat(1000000); // '976.56 KB'
fileSizeFormat(100000000, 3); // '95.367 MB'
fileSizeFormat(100000000, 0, true); // '96 MB'
dart
fileSizeFormat(1000000); // '976.56 KB'
fileSizeFormat(100000000, decimals: 3); // '95.367 MB'
fileSizeFormat(100000000, ceil: true); // '96 MB'
python
fileSizeFormat(1000000)  # '976.56 KB'
fileSizeFormat(100000000, 3)  # '95.367 MB'
fileSizeFormat(100000000, 0, True)  # '96 MB'

Released under the MIT License