mirror of
https://github.com/denoland/deno.git
synced 2024-11-23 15:16:54 -05:00
Fix URLs in examples/README (denoland/deno_std#551)
Original: 6d78eec413
This commit is contained in:
parent
b1e5ad7eca
commit
782ebfbc0f
1 changed files with 24 additions and 13 deletions
|
@ -1,36 +1,47 @@
|
||||||
# Deno example programs
|
# Deno example programs
|
||||||
|
|
||||||
This module contains small scripts that demonstrate use of Deno and its standard library.
|
This module contains small scripts that demonstrate use of Deno and its standard
|
||||||
|
module.
|
||||||
|
|
||||||
You can run these examples by importing them via `deno` command:
|
You can run these examples using just their URL or install the example as an
|
||||||
|
executable script which references the URL. (Think of installing as creating a
|
||||||
|
bookmark to a program.)
|
||||||
|
|
||||||
```
|
### A TCP echo server
|
||||||
> deno https://deno.land/std/examples/echo_server.ts --allow-net
|
|
||||||
|
```shell
|
||||||
|
deno https://deno.land/std/examples/echo_server.ts --allow-net
|
||||||
```
|
```
|
||||||
|
|
||||||
Some of them are useful CLI programs that can be installed as executables:
|
Or
|
||||||
|
|
||||||
`cat.ts` - print file to standard output
|
|
||||||
|
|
||||||
|
```shell
|
||||||
|
deno install echo_server https://deno.land/std/examples/echo_server.ts --allow-net
|
||||||
```
|
```
|
||||||
deno install deno_cat https://deno.land/examples.cat.ts --allow-read
|
|
||||||
|
### cat - print file to standard output
|
||||||
|
|
||||||
|
```shell
|
||||||
|
deno install deno_cat https://deno.land/stdexamples/cat.ts --allow-read
|
||||||
deno_cat file.txt
|
deno_cat file.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
`catj.ts` - print flattened JSON to standard output
|
### catj - print flattened JSON to standard output
|
||||||
|
|
||||||
```
|
A very useful command by Soheil Rashidi ported to Deno.
|
||||||
deno install catj https://deno.land/examples/catj.ts --allow-read
|
|
||||||
|
```shell
|
||||||
|
deno install catj https://deno.land/std/examples/catj.ts --allow-read
|
||||||
catj example.json
|
catj example.json
|
||||||
catj file1.json file2.json
|
catj file1.json file2.json
|
||||||
echo example.json | catj -
|
echo example.json | catj -
|
||||||
```
|
```
|
||||||
|
|
||||||
`gist.ts` - easily create and upload Gists
|
### gist - 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
|
export GIST_TOKEN=ABC # Generate at https://github.com/settings/tokens
|
||||||
|
deno install gist https://deno.land/std/examples/gist.ts --allow-net --allow-env
|
||||||
gist --title "Example gist 1" script.ts
|
gist --title "Example gist 1" script.ts
|
||||||
gist --t "Example gist 2" script2.ts
|
gist --t "Example gist 2" script2.ts
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue