How to write the text in .txt file

Through codeceptjs, how can I write some text in .txt or .html file. I required this to save execution logs.

You can use File helper of codeceptjs to do that.

Use “>” operator.
Like: npx codecept run your_test.js > log.txt

Thanks for the support, would you please let me know how to add the File helper in Codecept.conf.js file

https://codecept.io/helpers/FileSystem#docsNav

In your config file, add it after your current helper

...
helpers: {
   FileSystem: {}
}