Skip to main content

Posts

Featured

SSH2-SFTP-client get and Fast Get

  Here we will be checking on how to get the files over the sftp, As there is alot of confusion on how to fetch the files in the required format, it can be a file path or a stream or just a Buffer. We would be using the  ssh2-sftp-client  library of the node js. There are two methods for getting the file and these methods are async in nature. **_- get(path, dst, options) ==> String|Stream|Buffer fastGet(remotePath, localPath, options) ===> string_** Let us go with the Get. Here if we are just giving the path of the file which needs to be fetched and not providing dst and the options then the output would be in the form of buffer, so if we want to transfer this buffer as a stream to the output then We would be adding this to the Readable stream. This readable stream can be piped to the response and can be sent out. This readable stream can also be added to the zip stream and that zip stream can be piped to response, if we want to zip the files before sending, this is useful if we

Latest Posts