aboutsummaryrefslogtreecommitdiff
path: root/target/linux/ipq806x/base-files/usr/bin/base64decode.uc
blob: 7dcf30986c045dd92b6ea010319d6f6dee026ed6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/ucode

import { stdin, open, error } from 'fs';

if (length(ARGV) == 0 && stdin.isatty()) {
	warn("usage: b64decode [stdin|path]\n");
	exit(1);
}

let fp = stdin;
let source = ARGV[0];

if (source) {
	fp = open(source);
	if (!fp) {
		warn('b64decode: unable to open ${source}: ${error()}\n');
		exit(1);
	}
}

print(b64dec(fp.read("all")));
fp.close();
exit(0);