blob: 72377ff93a5e38269b7dca8f4aa197d3cac3406d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const { args, readFileSync, writeFileSync, exit, dial } = Deno;
const name = args[1];
const test: (args: string[]) => void = {
read: (files: string[]): void => {
files.forEach((file): any => readFileSync(file));
},
write: (files: string[]): void => {
files.forEach(
(file): any => writeFileSync(file, new Uint8Array(), { append: true })
);
},
net: (hosts: string[]): void => {
hosts.forEach((host): any => fetch(host));
}
}[name];
if (!test) {
console.log("Unknown test:", name);
exit(1);
}
test(args.slice(2));
|