You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been working happily with ftps using the execAsStream feature, piping data out of the stream.
Now I ran into a use case where I want execute many commands, and I can't really bundle all the commands into the command array because there are too many.
I started by invoking execAsStream for each command but this seems to be a deadend because of the overhead of the connection (I need to connect to the ftp server for each command which takes time)
Now I realized that execAsStream also works if instead of the lftp -c option, we use lftp -e.
This way, it is possible to write things like
var ftps = new lftp(config)
var stream = ftps.raw('cd /myRep').execAsStream()
stream.pipe(process.stdout)
stream.write('ls;\n');
stream.write('cd myRep2;\n');
setTimeout(function() {}, 1000) {
stream.write('ls;\n');
stream.write('exit;\n');
}
or pipe any stream of command into lftp.
This is a huge boost because this way we can maintain the lftp session (no need for reconnection) and write sequences of commands to it.
I don't think there are many users of the execAsStream feature so I propose to make the change and change the documentation accordingly (this would require a major version change because users would need to call stream.write('exit;\n'); to end the lftp session)
Another option would be to have a new method, execAsDuplex which would make it clear that
execAsStream is a Readable
execAsDuplex is a Duplex stream
What do you think ?
The text was updated successfully, but these errors were encountered:
Hello,
I have been working happily with ftps using the execAsStream feature, piping data out of the stream.
Now I ran into a use case where I want execute many commands, and I can't really bundle all the commands into the command array because there are too many.
I started by invoking execAsStream for each command but this seems to be a deadend because of the overhead of the connection (I need to connect to the ftp server for each command which takes time)
Now I realized that execAsStream also works if instead of the
lftp -c
option, we uselftp -e
.This way, it is possible to write things like
This is a huge boost because this way we can maintain the lftp session (no need for reconnection) and write sequences of commands to it.
I don't think there are many users of the execAsStream feature so I propose to make the change and change the documentation accordingly (this would require a major version change because users would need to call stream.write('exit;\n'); to end the lftp session)
Another option would be to have a new method,
execAsDuplex
which would make it clear thatWhat do you think ?
The text was updated successfully, but these errors were encountered: