NetSuite Secure File Transfer Protocol Module

A recent feature introduced in SuiteScript API 2016.2 is the ability to connect to SFTP servers directly from NetSuite. In SuiteScript API 1.0 you had to use a middleware server for an FTP connection, which not only caused a dependency on middleware but was also time consuming and costly. The new SFTP module in SuiteScript API 2016.2 eliminates these issues. However, it does have some shortcomings of its own, such as:

There is no way to list the contents of a remote directory

The NetSuite SFTP module does not support all types of servers, as NetSuite requires a supported server for encryption algorithms.

Next, you’ll need to load the SFTP module to connect to a remote FTP server via SFTP and transfer files.

Upload And Download File

You can create a file to upload to the path of the server by using the function below.var myFileToUpload = file.create({
name: 'file.txt',
fileType: file.Type.PLAINTEXT,
contents: 'This is uploaded using sftp API in SuiteScript 2.0'
});