Connection.download(options)
Method Description |
Downloads a file from the remote FTP server. |
Returns |
file.File Object |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
100 units |
Module |
|
Since |
2016.2 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
required |
The name of the file to download. |
2016.2 |
|
string |
optional |
The relative path to the directory that contains the file to download. By default, the path is set to the current directory.
Important:
This input must take the form of a relative path. |
2016.2 |
|
number |
optional |
The number of seconds to allow for the file to download. By default, this value is set to 300 seconds. |
2016.2 |
Errors
Error Code |
Thrown If |
---|---|
|
The file size is greater than the maximum file size allowed by NetSuite. |
|
The file or directory does not exist. |
|
The transfer is taking longer than the specified options.timeout value. |
|
The options.timeout value is either a negative value, zero or greater than 300 seconds. |
|
Access to the file or directory on the remote FTP server was denied. |
|
The connection was reset. |
|
The file’s remote path is invalid. |
|
The connection was closed by the host. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/sftp Module Script Samples.
//Add additional code
...
var downloadedFile = objConnection.download({
directory: 'relative/path/to/file',
filename: 'downloadMe.js'
});
...
//Add additional code