This is an FYI - if you've ever tried creating a csv file in SuiteScript from a Saved Search, it's quite difficult using the N/file module (iterating through all the search results, manually escaping characters, adding lines one by one to the file, etc.). However, I recently discovered that it can be done in just a few lines of code using the N/task module. Check out this article to see how it's done. It saved me a lot of time and energy. Plus, it runs much faster.
https://ceanatech.com/2019/02/27/suitescript-2-0-why-you-should-check-out-n-task-searchtask/