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
Proposals
A
Signature
file.create(options)
Module
N/file
Returns
file.File
Governance
None
Script types
Server scripts
Version
SuiteScript 2.x, documented for 2.1; since NetSuite 2015.2
call shapefrom Oracle's parameter table
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});
Oracle reference for this method
ParameterTypeRequiredDescription
options.namestringrequiredThe file name and extension. Sets the value for the File.name property.
options.fileTypeenumrequiredThe 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.contentsstringoptionalThe 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.foldernumberoptionalThe 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.encodingstringoptionalThe 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.isInactivebooleanoptionalThe 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.isOnlinebooleanoptionalThe 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

No Mynt syntax yet.

Nothing in the language compiles to file.create(options) today. How should it read?

C

Competing syntax for create, from GitHub Discussions. Select two or more to compare them side by side.

All discussions

Loading proposals from GitHub…

D

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, save and Ref[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?

N/file · file.create(options)

Suggest syntax for create