file.create(options)
Method Description |
Method used to create a new file in the NetSuite File Cabinet.
Important:
Content held in memory is limited to 10MB. |
Returns |
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2015.2 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
required |
|
2015.2 |
|
enum |
required |
|
2015.2 |
|
string |
optional |
|
2015.2 |
|
string |
optional |
|
2016.2 |
|
number |
optional |
|
2016.1 |
|
string |
optional |
|
2016.2 |
|
boolean |
optional |
|
2016.2 |
|
boolean |
optional |
|
2016.2 |
Errors
Error Code |
Message |
Thrown If |
---|---|---|
|
<name of missing parameter> |
A required argument is not passed. |
|
You have entered an invalid type argument: <passed type argument> |
The argument for File.fileType is invalid. |
|
The file you are trying to create exceeds the maximum allowed file size of 10.0 MB. |
You attempt to create a file larger than 10MB. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/file Module Script Samples.
//Add additional code
...
var fileObj = file.create({
name: 'test.txt',
fileType: file.Type.PLAINTEXT,
contents: 'Hello World\nHello World',
description: 'This is a plain text file.',
encoding: file.Encoding.UTF8,
folder: 30,
isOnline: true
});
...
//Add additional code