Archiver.add(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Adds a file to be archived.

In the archive, the path to the target file is options.directory or options.file.nam. If the options.directory parameter is not specified, the target file is located in the root directory of the archive.

Returns

void

Supported Script Types

Server scripts

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

Governance

None

Module

N/compress Module

Parent Object

compress.Archiver

Sibling Object Members

Archiver Object Members

Since

2020.2

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.file

file.File

required

The file to be archived.

options.directory

string

optional

The target directory in the archive.

If this parameter is not specified, the file is placed in the root directory of the archive.

Errors

Error Code

Thrown If

COMPRESS_API_DUPLICATE_PATH

A file has already been added using the same target path.

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/compress Module Script Sample.

            // Add additional code
...
archiver.add({
    file: myJpegFile,
    directory: 'pics/'
});
archiver.add({
    file: myTxtFile
});
...
// Add additional code 

          

Related Topics

compress.Archiver
N/compress Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices