MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / bytesFromHumanFileSize

Function bytesFromHumanFileSize

public/ts/utils/files.ts:27–33  ·  view source on GitHub ↗
(humanFileSize: string)

Source from the content-addressed store, hash-verified

25}
26
27export function bytesFromHumanFileSize(humanFileSize: string) {
28 const [numberString, unit] = humanFileSize.split(' ');
29 const number = Number.parseFloat(numberString);
30
31 return number *
32 (unit === 'B' ? 1 : 1024 ** (['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'].indexOf(unit) + 1));
33}
34
35export type SortColumn = 'name' | 'updated_at' | 'size_in_bytes';
36export type SortOrder = 'asc' | 'desc';

Callers 2

files_test.tsFile · 0.90
getDirectorySizeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected