UNPKG

psn-api

Version:

A well-tested library that lets you get trophy, user, and game data from the PlayStation Network.

17 lines (16 loc) 572 B
/** * Cross-platform base64 decoding function */ export function decodeBase64(base64String: string): string { try { if (typeof window !== "undefined" && typeof window.atob === "function") { return window.atob(base64String); // Browser decoding } else if (typeof Buffer !== "undefined") { return Buffer.from(base64String, "base64").toString("utf8"); // Node.js decoding } else { throw new TypeError("Base64 decoding unsupported in this environment"); } } catch (error) { throw new Error(`Base64 decoding error: ${error}`); } }