MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / normalizeBase64

Function normalizeBase64

packages/plugins/openapi/src/sdk/invoke.ts:366–372  ·  view source on GitHub ↗
(value: string, encoding: "base64" | "base64url")

Source from the content-addressed store, hash-verified

364};
365
366const normalizeBase64 = (value: string, encoding: "base64" | "base64url"): string => {
367 const compact = value.replace(/\s/g, "");
368 const alphabet =
369 encoding === "base64url" ? compact.replace(/-/g, "+").replace(/_/g, "/") : compact;
370 const remainder = alphabet.length % 4;
371 return remainder === 0 ? alphabet : `${alphabet}${"=".repeat(4 - remainder)}`;
372};
373
374const byteLengthFromBase64 = (base64: string): number => {
375 const compact = base64.replace(/\s/g, "");

Callers 2

base64ToUint8ArrayFunction · 0.85
fileFromByteFieldFunction · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected