Archiver.archive(options)
Method Description |
Creates an archive with the added files and returns it as a temporary file object. |
Returns |
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
25 units |
Module |
|
Parent Object |
|
Sibling Object Members |
|
Since |
2020.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
string |
required |
The name of the archive file. |
|
string |
optional |
The archive type. See the compress.Type enum. This parameter does not need to be specified if
|
Errors
Error Code |
Thrown If |
---|---|
|
The |
|
The |
|
The contents cannot be retrieved for any of the files to be archived. |
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
...
var archiver = compress.createArchiver();
archiver.add({
file: binaryFile
});
archiver.add({
file: textFile,
directory: 'txt/'
});
var zipFile = archiver.archive({
name: 'myarchive.zip'
});
var tgzFile = archiver.archive({
name: 'myarchive.tar.gz'
});...
// Add additional code