Passer au contenu principal

sftp@0.6.7

Functions

execute(operations)Operation

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

list(dirPath)Operation

List files present in a directory

getCSV(filePath)Operation

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

putCSV(localFilePath, remoteFilePath, parsingOptions)Operation

Convert JSON to CSV and upload to an FTP server

getJSON(filePath, encoding)Operation

Fetch a json file from an FTP server

normalizeCSVarray(options, callback)Operation

Convert JSON array of strings into a normalized object

execute(operations) ⇒ Operation

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

Kind: global function

ParamTypeDescription
operationsOperationsOperations to be performed.

Example

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

list(dirPath) ⇒ Operation

List files present in a directory

Kind: global function
Access: public

ParamTypeDescription
dirPathstringPath to resource

Example

list('/some/path/')

getCSV(filePath) ⇒ Operation

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

Kind: global function
Access: public

ParamTypeDescription
filePathstringPath to resource

Example

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

putCSV(localFilePath, remoteFilePath, parsingOptions) ⇒ Operation

Convert JSON to CSV and upload to an FTP server

Kind: global function
Access: public

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 }
);

getJSON(filePath, encoding) ⇒ Operation

Fetch a json file from an FTP server

Kind: global function
Access: public

ParamTypeDescription
filePathstringPath to resource
encodingstringCharacter encoding for the json

Example

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

normalizeCSVarray(options, callback) ⇒ Operation

Convert JSON array of strings into a normalized object

Kind: global function
Access: public

ParamTypeDescription
optionsoptionsOptions passed to csvtojson parser
callbackcallbackOptions passed to csvtojson parser

Example

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