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
Param | Type | Description |
---|---|---|
operations | Operations | Operations to be performed. |
Example
execute(
create('foo'),
delete('bar')
)(state)
list(dirPath) ⇒ Operation
List files present in a directory
Kind: global function
Access: public
Param | Type | Description |
---|---|---|
dirPath | string | Path 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
Param | Type | Description |
---|---|---|
filePath | string | Path 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
Param | Type | Description |
---|---|---|
localFilePath | string | Data source for data to copy to the remote server. |
remoteFilePath | string | Path to the remote file to be created on the server. |
parsingOptions | object | Options 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
Param | Type | Description |
---|---|---|
filePath | string | Path to resource |
encoding | string | Character 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
Param | Type | Description |
---|---|---|
options | options | Options passed to csvtojson parser |
callback | callback | Options passed to csvtojson parser |
Example
normalizeCSVarray({ delimiter: ';', noheader: true });