File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,11 @@ export const sidebar = [
55
55
"https://www.youtube.com/watch?v=bTmO5Tfgke4&list=PLvvLnBDNuTEov9EBIp3MMfHlBxaKGRWTe&index=10" ,
56
56
type : "video" ,
57
57
} ,
58
+ {
59
+ title : "Top level await" ,
60
+ href : "/examples/top_level_await/" ,
61
+ type : "example" ,
62
+ } ,
58
63
{
59
64
title : "Update from CommonJS to ESM" ,
60
65
href : "/examples/cjs_to_esm_tutorial/" ,
Original file line number Diff line number Diff line change 3
3
* @difficulty beginner
4
4
* @tags cli
5
5
* @resource {https://docs.deno.com/api/deno/~/Deno.readTextFile} Doc: Deno.readTextFile
6
+ * @run <url>
6
7
* @group Basics
7
8
*
8
9
* Example of how top-level await can be used by default in Deno. This example would assist in migrating from NodeJS (CommonJS) to Deno.
12
13
13
14
// This example is what you may be used to with NodeJS when using CommonJS modules.
14
15
// Notice that for "await" to be used in this example, it must be wrapped in an "async" function.
15
- const fs = require ( "fs" ) ;
16
+ const fs = require ( "node: fs" ) ;
16
17
17
18
async function readFile ( ) {
18
19
try {
You can’t perform that action at this time.
0 commit comments