From 151ce0266eb4de2c8fc600c81c192a5f791b6169 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 9 Oct 2019 17:10:09 -0400 Subject: Move everything into std subdir --- std/examples/README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 std/examples/README.md (limited to 'std/examples/README.md') diff --git a/std/examples/README.md b/std/examples/README.md new file mode 100644 index 000000000..e6102a843 --- /dev/null +++ b/std/examples/README.md @@ -0,0 +1,47 @@ +# 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 + +```shell +deno https://deno.land/std/examples/echo_server.ts --allow-net +``` + +Or + +```shell +deno install echo_server https://deno.land/std/examples/echo_server.ts --allow-net +``` + +### cat - print file to standard output + +```shell +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. + +```shell +deno install catj https://deno.land/std/examples/catj.ts --allow-read +catj example.json +catj file1.json file2.json +echo example.json | catj - +``` + +### 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 +``` -- cgit v1.2.3