RE: Can the N/file Module Be Used in a Client Script
I’m trying to create a CSV file within a client script, but I keep getting the following error saying the module does not exist.
Fail to evaluate script: {“type”:”error.SuiteScriptModuleLoaderError”,”name”:”MODULE_DOES_NOT_EXIST”,”message”:”Module does not exist: N/file.js”,”stack”:[]}
Here’s my define statement. I don’t see a typo.
Does the file module not work in a client script?
No, N/file Module members are all server-side (/app/help/helpcenter.nl?fid=section_4205693274.html)
If you wanted to do file operations via Client script, you would need to push this functionality using a server-side script type such as Suitelet.

Ok, gotcha. I’m trying to create the file so I can send it in an email. It looks like I can use N/email in the client script. Would I be able to have the suitelet create the file and return the ID so I can attach it to the email?
the attachments parameter of email.send() action uses file.File, so you just need to create the File object you do not have to save it. (/app/help/helpcenter.nl?fid=section_4358681681.html)

Ok, thanks!