Bookmark this: tool.io/decode/base64/source-code
Decode Base64 Source Code
Browse the implementation files for Decode Base64.tool.ts typescript
import { decodeBase64 as decodePortableBase64 } from '@tool.io/tools/decode/base64';
export const base64Decode = (input: unknown): string => {
if (typeof input !== 'string' || input.trim() === '')
return '';
try {
return decodePortableBase64(input);
} catch {
return '';
}
};
// The tool definition.
export const Tool: TypeTool = {
name: 'Decode Base64',
slug: 'decode/base64',
intro:
'Base64 Tool enables you to decode base64 and encode text to base64.',
tool: base64Decode,
i: [
{
example: 'VG9vbC5pbyBpcyBhd2Vzb21lIQ==',
help: 'Put base64 encoded text here, e.g.',
label: 'Base64',
placeholder: 'Paste Base64 to decode here...',
type: 'text',
render: 'textarea'
}
],
o: [
{
example: 'Tool.io is awesome!',
help: 'Decoded text will appear here',
label: 'Text',
placeholder: 'Decoded text will appear here...',
render: 'textarea',
type: 'text'
}
],
swap: {
state: false,
name: 'Base64 Encode',
target: 'encode/base64'
},
alternative: [
{ title: 'Base64 Encode', url: '/encode/base64' }
],
equation:
'$$ Base64(\\text{tool.io}) \\rightarrow \\text{dG9vbC5pbw==} $$'
};
export default Tool;
Description
Browse the implementation files for Decode Base64.