@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
29 lines • 1.16 kB
JavaScript
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
export function encodeBase64(bytes) {
let s = '';
const chunk = 0x8000;
for (let i = 0; i < bytes.byteLength; i += chunk) {
s += String.fromCharCode(...bytes.subarray(i, i + chunk));
}
return btoa(s);
}
export function decodeBase64(str) {
const s = atob(str);
const out = new Uint8Array(s.length);
for (let i = 0; i < s.length; i++)
out[i] = s.charCodeAt(i);
return out;
}
//# sourceMappingURL=base64.js.map