module function · N/file
create()
file.create(options)
Creates a new file.File .
- Implementation
- Not started
- Design
- Open for proposals suggest how it should read
A
suitescript api
1file.create({2 name: /* string, required */,3 fileType: /* enum, required */,4 contents: /* string, optional */,5 folder: /* number, optional */,6 encoding: /* string, optional */,7 isInactive: /* boolean, optional */,8 isOnline: /* boolean, optional */9});
| Parameter | Type | Required | Description |
|---|---|---|---|
| options.name | string | required | The file name and extension. Sets the value for the File.name property. |
| options.fileType | enum | required | The file type. Sets the value for the File.fileType property. This property is read-only and cannot be changed after the file is created. Use the file.Type enum to set the value. |
| options.contents | string | optional | The file content. File content is lazy loaded; there is no property for it. If the file type is binary (for example, PDF), the file content must be base64 encoded. |
| options.folder | number | optional | The internal ID of the folder within the NetSuite File Cabinet. You must set the File Cabinet folder before you upload a file to the NetSuite File Cabinet with File.save() . Sets the value for the File.folder property. |
| options.encoding | string | optional | The character encoding on a file. Sets the value for the File.encoding property. Use the file.Encoding enum to set the value. For more information about converting strings to another type of encoding, see N/encode Module . |
| options.isInactive | boolean | optional | The inactive status of a file. If set to true, the file is inactive. The default value is false. When a file is inactive, it does not display in the UI unless you select Show Inactives on the File Cabinet page. Sets the value for the File.isInactive property. |
| options.isOnline | boolean | optional | The Available without Login status of a file. If set to true, users can download the file outside of a current netSuite login session. The default value is false. Sets the value for the File.isOnline property. |
B
mynt syntax
No Mynt syntax yet.
Nothing in the language compiles to file.create(options) today. How should it read?
C
community proposals
Competing syntax for create, from GitHub Discussions. Select two or more to compare them side by side.
Loading proposals from GitHub…
D
suggest an alternative
Write the Mynt you wish you could write.
A good proposal shows the syntax, the SuiteScript it should become, and argues for it: why it is clearer, how it fits the rest of the language, what it makes harder.
- Clarity. Does it say what happens, without ceremony?
- Consistency. Does it read like
load,saveandRef[field]? - Expressiveness. Does it cover the cases people actually write?
- Honesty. Does it hide a NetSuite cost, such as governance, that a reader should see?