converter/src/app/converter/quotedprintabledecoder.ts

25 lines
649 B
TypeScript

import {Converter} from "./converter";
import {NativeLibraryWrapperService} from "../nativelibrarywrapper.service";
export class QuotedPrintableDecoder implements Converter {
constructor(private nativeLibraryWrapperService: NativeLibraryWrapperService) {
}
getDisplayname(): string {
return "Decode quoted printable";
}
getId(): string {
return "decodequotedprintable";
}
convert(input: string): string {
try {
return this.nativeLibraryWrapperService.quotedPrintable.decode(input);
} catch (error) {
throw new Error("The input can not be interpreted as quoted-printable. May be corrupt?");
}
}
}