diff --git a/frontend/src/helpers.js b/frontend/src/helpers.js
index cbf7579e2..39e152e31 100644
--- a/frontend/src/helpers.js
+++ b/frontend/src/helpers.js
@@ -52,13 +52,31 @@ export function buf2hex(buffer, joinchar) {
.join(joinchar ? joinchar : "");
}
-/**
+/***
* Asynchronously sleep for a certain number of milliseconds.
*/
export async function sleep(ms) {
await new Promise((resolve) => setTimeout(resolve, ms));
}
+/**
+ * Turn a number of bytes into a text-based file size
+ */
+export function numBytesToQuantity(bytes) {
+ if (bytes < 1024) {
+ return `${bytes}B`;
+ } else if (bytes < 1024 * 1024) {
+ return `${(bytes / 1024).toFixed(2)}KB`;
+ } else if (bytes < 1024 * 1024 * 1024) {
+ return `${(bytes / (1024 * 1024)).toFixed(2)}MB`;
+ } else if (bytes < 1024 * 1024 * 1024 * 1024) {
+ return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)}GB`;
+ } else {
+ // TODO if necessary
+ return `${bytes}B`;
+ }
+}
+
/***
* Evaluate an input arithmetic string consisting of (possibly hex) numbers
* and the given binary operators using the Shunting Yard algorithm
diff --git a/ofrak_core/CHANGELOG.md b/ofrak_core/CHANGELOG.md
index 4fc9bc552..fcaee5bed 100644
--- a/ofrak_core/CHANGELOG.md
+++ b/ofrak_core/CHANGELOG.md
@@ -10,7 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fix bug in `SegmentInjectorModifier` that resulted in deleting more resources than necessary [#200](https://github.com/redballoonsecurity/ofrak/pull/200)
### Added
-- Replace unofficial p7zip with official 7zip package.
+- Replace unofficial p7zip with official 7zip package
+- File browser dialog in the GUI
- Area in the GUI to jump to a given data offset
- GUI command line now has a flag to not automatically open the browser