summaryrefslogtreecommitdiff
path: root/examples/README.md
blob: 6a4924f5d20dc0a5a5fe7cc2e0124e5b2180980b (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
25
26
27
28
29
30
31
32
33
34
35
36
# Deno example programs

This module contains small scripts that demonstrate use of Deno and its standard library.

You can run these examples by importing them via `deno` command:

```
> deno https://deno.land/std/examples/echo_server.ts --allow-net
```

Some of them are useful CLI programs that can be installed as executables:

`cat.ts` - print file to standard output

```
deno install deno_cat https://deno.land/examples.cat.ts --allow-read
deno_cat file.txt
```

`catj.ts` - print flattened JSON to standard output

```
deno install catj https://deno.land/examples/catj.ts --allow-read
catj example.json
catj file1.json file2.json
echo example.json | catj -
```

`gist.ts` - easily create and upload Gists

```
deno install gist https://deno.land/examples/gist.ts --allow-net --allow-env
export GIST_TOKEN=ABC # Generate at https://github.com/settings/tokens
gist --title "Example gist 1" script.ts
gist --t "Example gist 2" script2.ts
```