File.getContents()
The content in this help topic pertains to SuiteScript 2.0.
Method Description |
Method used to return the content of the file.
Important:
Content held in memory is limited to 10MB.
Note:
You can access CSV or text files (including files over 10MB) using File.appendLine(options) or File.lines.iterator(). |
Returns |
The file content as a string. |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2015.2 |
Errors
Error Code |
Message |
Thrown If |
---|---|---|
|
The file content you are attempting to access exceeds the maximum allowed size of 10 MB. |
You attempt to return the content of 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.load({
id: 145
});
if (fileObj.size < 10485760){
fileObj.getContents();
}
...
//Add additional code