Modules

filter

 

Objects/Functions

module (N/sftp)

SuiteScript 2.0

sftp.createConnection(options)

{sftp}.createConnection({url: {string},passwordGuid: {string},hostKey: {string},username: {string},port: {number},directory: ${7:string},timeout: ${8:number},hostKeyType: ${9:string},keyId: {0:string}})

N/sftp Module
sftp.createConnection()
Method Description: Establishes a connection to a remote FTP server. To generate the passwordguid, you can create a suitelet that uses Form.addCredentialField(options). Use the N/https Module to fetch the GUID value returned from the Suitelet's credential field. For more information, see Setting up an SFTP Transfer and Supported Cipher Suites and Host Key Types.
Returns: sftp.Connection, representing that connection.
Supported Script Types: All server-side scripts For more information, see SuiteScript 2.0 Script Types.
Governance: None
Module: N/sftp Module
Since: 2016.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=sftp.createConnection(options)

Example:

// Code Example 1
//Add additional code
//...
// establish connection to the ftp server

var objConnection = sftp.createConnection({
username: 'username',
keyId: 'custkey1'
url: 'host.somewhere.com',
directory: 'username/wheres/my/file'
hostKey: myHostKey // references var myHostKey
});
//...
//Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4617005472.html