feat: add identity and feed management (#272)
* feat(wip): add basic feed operations * ci: bump checks * ci: bump checks * feat: rework stamps and add feed functionalities * refactor: polish and fixes * feat(wip): add formulas * feat: show bzz.link for websites * feat: add stamp empty states and formatBzz * feat: add feed download * chore: update manifest-js version * feat: dev mode support with bee-js 3.1.0 (#273) * feat: dev mode support with bee-js 3.1.0 * fix: added missing package-lock.json file * build: remove PR preview * style: work on design * feat: add TroubleshootConnectionCard * build: remove depcheck Co-authored-by: Attila Gazso <agazso@gmail.com>
This commit is contained in:
@@ -30,6 +30,18 @@ export function detectIndexHtml(files: SwarmFile[]): string | false {
|
||||
}
|
||||
|
||||
export function getHumanReadableFileSize(bytes: number): string {
|
||||
if (bytes >= 1e15) {
|
||||
return (bytes / 1e15).toFixed(2) + ' PB'
|
||||
}
|
||||
|
||||
if (bytes >= 1e12) {
|
||||
return (bytes / 1e12).toFixed(2) + ' TB'
|
||||
}
|
||||
|
||||
if (bytes >= 1e9) {
|
||||
return (bytes / 1e9).toFixed(2) + ' GB'
|
||||
}
|
||||
|
||||
if (bytes >= 1e6) {
|
||||
return (bytes / 1e6).toFixed(2) + ' MB'
|
||||
}
|
||||
@@ -65,6 +77,10 @@ export function convertManifestToFiles(files: Record<string, string>): SwarmFile
|
||||
}
|
||||
|
||||
export function getAssetNameFromFiles(files: SwarmFile[]): string {
|
||||
if (!files.length) {
|
||||
return 'Unknown'
|
||||
}
|
||||
|
||||
if (files.length === 1) {
|
||||
return files[0].name
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user