Skip to main content

sftp@0.6.4

Adaptor

Adaptor.list

Kind: static class of Adaptor
Access: public

new exports.list(dirPath)

List files present in a directory

ParamTypeDescription
dirPathstringPath to resource

Example

list('/some/path/')

Adaptor.getCSV

Kind: static class of Adaptor
Access: public

new exports.getCSV(filePath)

Get a CSV and return a JSON array of strings for each item separated by the delimiter

ParamTypeDescription
filePathstringPath to resource

Example

getCSV(
'/some/path/to_file.csv'
);

Adaptor.putCSV

Kind: static class of Adaptor
Access: public

new exports.putCSV(localFilePath, remoteFilePath, parsingOptions)

Convert JSON to CSV and upload to an FTP server

ParamTypeDescription
localFilePathstringData source for data to copy to the remote server.
remoteFilePathstringPath to the remote file to be created on the server.
parsingOptionsobjectOptions which can be passed to adjust the read and write stream used in sending the data to the remote server

Example

putCSV(
'/some/path/to_local_file.csv',
'/some/path/to_remove_file.csv',
{ delimiter: ';', noheader: true }
);

Adaptor.getJSON

Kind: static class of Adaptor
Access: public

new exports.getJSON(filePath, encoding)

Fetch a json file from an FTP server

ParamTypeDescription
filePathstringPath to resource
encodingstringCharacter encoding for the json

Example

getJSON(
'/path/To/File',
'utf8',
);

Adaptor.normalizeCSVarray

Kind: static class of Adaptor
Access: public

new exports.normalizeCSVarray(options, callback)

Convert JSON array of strings into a normalized object

ParamTypeDescription
optionsoptionsOptions passed to csvtojson parser
callbackcallbackOptions passed to csvtojson parser

Example

normalizeCSVarray({ delimiter: ';', noheader: true });

Adaptor.execute(operations) ⇒ Operation

Execute a sequence of operations. Wraps language-common/execute, and prepends initial state for http.

Kind: static method of Adaptor

ParamTypeDescription
operationsOperationsOperations to be performed.

Example

execute(
create('foo'),
delete('bar')
)(state)