NODE.JS Programming, For Beginners, Learn Coding Fast! by Ray Yao

NODE.JS Programming, For Beginners, Learn Coding Fast! by Ray Yao

Author:Ray Yao [Yao, Ray]
Language: eng
Format: azw3, pdf
Publisher: Tutorial eBook & Book, A Quick Start Guide.
Published: 2020-08-03T16:00:00+00:00


2. Run “writestream. js”, and then check “newfile. txt”.

Output:

An example of writing a file stream

Finish Writing, please check newfile. txt

Explanation:

Please open the “newfile. txt”, you will find its new contents:

“Write the File Stream: GO IN 8 HOURS”

“require("fs");” imports “fs” module

“ fs.createWriteStream('newfile.txt');” creates a writing stream object of the “newfile. txt”.

“obj. end();” marks the end of the file.

“obj. on(…)” binds an event to callback function. When an event is triggered, the callback function will be called.

“e. stack”: the error messages.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.