| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f513e66 commit 6f58bc5
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,19 +53,10 @@ duplicate the browsers functionality exactly. | |||
| 53 | 53 | ||
| 54 | 54 | ## Asynchronous vs Synchronous Consoles | |
| 55 | 55 | ||
| 56 | - The console functions are synchronous when the destination is a terminal or | ||
| 57 | - a file (to avoid lost messages in case of premature exit) and asynchronous | ||
| 58 | - when the destination is a pipe (to avoid blocking for long periods of time). | ||
| 59 | - | ||
| 60 | - In the following example, stdout is non-blocking while stderr is blocking: | ||
| 61 | - | ||
| 62 | - ``` | ||
| 63 | - $ node script.js 2> error.log | tee info.log | ||
| 64 | - ``` | ||
| 65 | - | ||
| 66 | - Typically, the distinction between blocking/non-blocking is not important | ||
| 67 | - unless an application is logging significant amounts of data. High volume | ||
| 68 | - logging *should* use a `Console` instance that writes to a pipe. | ||
| 56 | + The console functions are asynchronous unless the destination is a file. | ||
| 57 | + Disks are fast and operating systems normally employ write-back caching; | ||
| 58 | + it should be a very rare occurrence indeed that a write blocks, but it | ||
| 59 | + is possible. | ||
| 69 | 60 | ||
| 70 | 61 | ## Class: Console | |
| 71 | 62 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments