diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-07-31 13:04:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-31 13:04:16 -0400 |
commit | 454ffaad9658256cb4980ee27eb013606b285edc (patch) | |
tree | 85638439db117db833d15a0184ecd45b1f1a83b6 /ext/js/media/audio-downloader.js | |
parent | 00c5ae79833a641ccc5f7d31b6eea3e91db4cb71 (diff) |
StringUtil (#1861)
* Add StringUtil class
* Use StringUtil
Diffstat (limited to 'ext/js/media/audio-downloader.js')
-rw-r--r-- | ext/js/media/audio-downloader.js | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/ext/js/media/audio-downloader.js b/ext/js/media/audio-downloader.js index e3b507b4..4bc4cf1b 100644 --- a/ext/js/media/audio-downloader.js +++ b/ext/js/media/audio-downloader.js @@ -19,6 +19,7 @@ * JsonSchema * NativeSimpleDOMParser * SimpleDOMParser + * StringUtil */ class AudioDownloader { @@ -257,7 +258,7 @@ class AudioDownloader { throw new Error('Could not retrieve audio'); } - const data = this._arrayBufferToBase64(arrayBuffer); + const data = StringUtil.arrayBufferToBase64(arrayBuffer); const contentType = response.headers.get('Content-Type'); return {data, contentType}; } @@ -288,10 +289,6 @@ class AudioDownloader { return digest; } - _arrayBufferToBase64(arrayBuffer) { - return btoa(String.fromCharCode(...new Uint8Array(arrayBuffer))); - } - _createSimpleDOMParser(content) { if (typeof NativeSimpleDOMParser !== 'undefined' && NativeSimpleDOMParser.isSupported()) { return new NativeSimpleDOMParser(content); |