Skip to content
Snippets Groups Projects
Commit 887cec3f authored by Jacopo Gasparetto's avatar Jacopo Gasparetto
Browse files

Add parseReadWrite utilty function

parent 050589ec
No related branches found
No related tags found
No related merge requests found
import { RWAccess } from "../models/bucket";
export const getHumanSize = (size: number) => {
if (size < 1000) return `${size} B`;
if (size < 1000000) return `${(size / 1000).toFixed(1)} kB`;
if (size < 1000000000) return `${(size / 1000000).toFixed(1)} MB`;
if (size < 1000000000000) return `${(size / 1000000000).toFixed(1)} GB`;
}
export const parseReadWriteAccess = (rwAccess: RWAccess) => {
return rwAccess.read && rwAccess.write ? "R/W" :
rwAccess.read ? "R" : rwAccess.write ? "R" : "Unknown";
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment