2016-09-20 20:30:39 +02:00
|
|
|
import {Converter} from "./converter";
|
2016-09-15 20:43:37 +02:00
|
|
|
|
|
|
|
export class Base64Decoder implements Converter {
|
|
|
|
getDisplayname():string {
|
|
|
|
return "Decode Base 64";
|
|
|
|
}
|
|
|
|
|
|
|
|
getId():string {
|
|
|
|
return "base64decode";
|
|
|
|
}
|
|
|
|
|
|
|
|
convert(input:string):string {
|
2016-09-21 13:36:39 +02:00
|
|
|
try {
|
|
|
|
return atob(input);
|
|
|
|
} catch (exception) {
|
|
|
|
throw new Error("Could not decode base64 string. Maybe corrupt input?");
|
|
|
|
}
|
2016-09-15 20:43:37 +02:00
|
|
|
}
|
|
|
|
}
|