ipq806x: Initial TP-Link and ASUS OnHub support
[openwrt/openwrt.git] / target / linux / ipq806x / base-files / usr / bin / base64decode.uc
1 #!/usr/bin/ucode
2
3 import { stdin, open, error } from 'fs';
4
5 if (length(ARGV) == 0 && stdin.isatty()) {
6 warn("usage: b64decode [stdin|path]\n");
7 exit(1);
8 }
9
10 let fp = stdin;
11 let source = ARGV[0];
12
13 if (source) {
14 fp = open(source);
15 if (!fp) {
16 warn('b64decode: unable to open ${source}: ${error()}\n');
17 exit(1);
18 }
19 }
20
21 print(b64dec(fp.read("all")));
22 fp.close();
23 exit(0);