1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-28 10:09:20 -05:00
denoland-deno/std/examples
Ry Dahl a4dde552de
Revert "feat(flags): script arguments come after '--'" (#3681)
Due to complaints about ergonomics and because it breaks shebang on
linux.

This reverts commit 2d5457df15.

BREAKING CHANGE
2020-01-15 19:21:35 -05:00
..
cat.ts feat: Deno.args now does not include script (#3628) 2020-01-09 11:37:01 -07:00
catj.ts feat: Deno.args now does not include script (#3628) 2020-01-09 11:37:01 -07:00
colors.ts Happy new year! (#3578) 2020-01-02 15:13:47 -05:00
curl.ts fix curl.ts (#3677) 2020-01-15 08:05:22 -06:00
echo_server.ts Happy new year! (#3578) 2020-01-02 15:13:47 -05:00
gist.ts feat: Deno.args now does not include script (#3628) 2020-01-09 11:37:01 -07:00
README.md fix curl.ts (#3677) 2020-01-15 08:05:22 -06:00
test.ts Revert "feat(flags): script arguments come after '--'" (#3681) 2020-01-15 19:21:35 -05:00
welcome.ts Add std/examples/welcome.ts (#3181) 2019-10-23 09:57:08 -07:00

Deno example programs

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

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

Or

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

cat - print file to standard output

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

catj - print flattened JSON to standard output

A very useful command by Soheil Rashidi ported to Deno.

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

curl - print the contents of a url to standard output

deno --allow-net=deno.land https://deno.land/std/examples/curl.ts -- https://deno.land/

gist - easily create and upload Gists

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 --t "Example gist 2" script2.ts