ServerResponse.writeFile(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Writes a file to the response.

Returns

void

Supported Script Types

Server scripts

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

Governance

None

Module

N/http Module

Parent Object

http.ServerResponse

Sibling Object Members

ServerResponse Object Members

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.file

file.File

required

A file.File Object that encapsulates the file to be written.

2015.2

options.isInline

boolean

optional

If true , the file is inline.

The default value is false.

2015.2

Errors

Error Code

Message

Thrown If

SSS_MISSING_REQD_ARGUMENT

Missing a required argument: {param name}

The options.file parameter is not specified.

WRONG_PARAMETER_TYPE

{param name}

The value input for options.file is not a file.File object.

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/http Module Script Samples.

          // Add additional code 
...
serverResponse.writeFile({
    file: myFileObj,
    isInline: true
});
...
// Add additional code 

        

Related Topics

http.ServerResponse
N/http Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices