icetee / node-ftp

An FTP client module for node.js
MIT License
25 stars 16 forks source link

documentation - clarify put behaviour if input is a string and file does not exist #10

Open PBug90 opened 5 years ago

PBug90 commented 5 years ago

Documentation currently states the following:

put(< mixed >input, < string >destPath, [< boolean >useCompression, ]< function >callback) - (void) - Sends data to the server to be stored as destPath. input can be a ReadableStream, a Buffer, or a path to a local file. useCompression defaults to false. callback has 1 parameter: < Error >err.

If the input argument is of type string, the function checks if that string is a path to an existing file by using fs.stat. If that file does not exist, the string itself will be transferred to the remote server and saved as a file containing the string in destPath.

For me this behaviour was unclear given the above description of the put operation and I had to take a look at the actual implementation here: https://github.com/icetee/node-ftp/blob/master/lib/connection.js#L1068