Archiver.add(options)
Method Description |
Adds a file to be archived. In the archive, the path to the target file is |
Returns |
void |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Parent Object |
|
Sibling Object Members |
|
Since |
2020.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
required |
The file to be archived. |
|
|
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 |
---|---|
|
A file has already been added using the same target path. |
|
The file cannot be compressed due to size; this happens for files >680MB. Binary/ASCII files have a higher limit of 2GB. |
Syntax
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