converter/src/app/converter/base64decoder.ts

20 lines
393 B
TypeScript

import {Converter} from "./converter";
export class Base64Decoder implements Converter {
getDisplayname(): string {
return "Decode Base 64";
}
getId(): string {
return "base64decode";
}
convert(input: string): string {
try {
return atob(input);
} catch (exception) {
throw new Error("Could not decode base64 string. Maybe corrupt input?");
}
}
}