File.appendLine(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Method used to insert a line to the end of a file.

This method can be used on text or .csv files.

Important:

Content held in memory is limited to 10MB. Therefore, each line must be less than 10MB.

Returns

file.File Object

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/file Module

Since

2017.1

Parameters
Note:

The options parameter is a JavaScript object. The table below describes the name:value pairs that make up the object.

Parameter

Type

Required / Optional

Description

Since

options.value

string

required

Object containing a string to insert at the end of the file.

2017.1

Errors

Error Code

Message

Thrown If

SSS_FILE_CONTENT_SIZE_EXCEEDED

The content you are attempting to access exceeds the maximum allowed size of 10 MB.

You attempt to return the content of a line larger than 10MB.

YOU_CANNOT_WRITE_TO_A_FILE_AFTER_YOU_BEGAN_READING_FROM_IT

You call File.appendLine(options) after calling File.lines.iterator(). To avoid receiving the error, call File.resetStream() or save the file.

Syntax
Important:

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
});
fileObj.appendLine({
    value: 'hello world'
});
...
//Add additional code 

        

Related Topics

file.File
N/file Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices