github.com/hernad/nomad@v1.6.112/ui/app/utils/classes/text-decoder.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 // This is a very incomplete polyfill for TextDecoder used only 7 // by browsers that don't provide one but still provide a ReadableStream 8 // interface for fetch. 9 10 // A complete polyfill exists if this becomes problematic: 11 // https://github.com/inexorabletash/text-encoding 12 export default window.TextDecoder || 13 function () { 14 this.decode = function (value) { 15 let text = ''; 16 for (let i = 3; i < value.byteLength; i++) { 17 text += String.fromCharCode(value[i]); 18 } 19 return text; 20 }; 21 };