Used Function: The writeFile() functions is used for writing operation.
writeFile( Path, Data, Callback)
Parameters: This method accepts three parameters as mentioned above and described below:
- Path: It takes in relative path from the program to the text File. If the file is to be created in the same folder as that of the program, then give the name of the file only. If file not exists then new file will be created automatically.
- Data: This argument takes in data which need to write in the file.
- Callback Function: It is the callback function which further has an argument (err). If the operation fails to write the data, err shows the fault.
Learning how to write in a file.
Note: Above script can be run using NodeJs interpreter in terminal.
- Transforming a Plain Text message to Cipher Text
- Sorting integer data from file and calculate execution time
- Difference between Data Scientist, Data Engineer, Data Analyst
- PHP program to fetch data from localhost server database using XAMPP
- CSS | Text Formatting
- CSS | Text Effects
- How to vertically center text with CSS?
- CSS | text-align Property
- CSS | text-decoration Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.