mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 15:32:33 +00:00
24 lines
373 B
Ucode
24 lines
373 B
Ucode
|
#!/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);
|