diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-03-11 00:06:51 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-03-11 00:06:51 +0100 |
| commit | f634e938d956268b66545a61a36e26887684a375 (patch) | |
| tree | 2c4b7e8b308fe81e3ac7cbbb9f52b7940869f6c9 /animism-align/frontend/app/utils | |
| parent | 382224e0f6ad0d226548046d23ef6df940a24414 (diff) | |
uploading peaks and audio file works!
Diffstat (limited to 'animism-align/frontend/app/utils')
| -rw-r--r-- | animism-align/frontend/app/utils/index.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/animism-align/frontend/app/utils/index.js b/animism-align/frontend/app/utils/index.js index 693a185..d76a319 100644 --- a/animism-align/frontend/app/utils/index.js +++ b/animism-align/frontend/app/utils/index.js @@ -81,6 +81,14 @@ export const timestamp = (n = 0, fps = 1, ms = false, h_label = ':', m_label = ' return (n % 60) + m_label + s + s_label } +export const formatSize = n => { + if (n < 1000) return n + " b." + if (n < 1000000) return (n / 1000).toFixed(1) + " kb." + if (n < 1000000000) return (n / 1000000).toFixed(1) + " mb." + if (n < 1000000000000) return (n / 1000000000).toFixed(1) + " gb." + return "Quite large." +} + export const timestampHMS = n => timestamp(n, 1, false, 'h', 'm', 's') export const timestampToSeconds = time_str => { |
