Open anvaya opened 8 years ago
This is not specific to the FTP adapter btw. This is a limitation due to the Adapter interface used in Gaufrette. And this cannot change without a major overhaul of the whole library.
@anvaya if your needs are only about FTP rather than about using the Gaufrette API, you could use ftp_fget
calls directly to perform reads, as it reads to a PHP stream (and ftp_fput
also reads from a stream)
Well, we are actually using it in a scenario where the document root can be a Local, FTP and probably going forward other sources like S3. Hence found this library extremely interesting.
We found some code that was very interesting:
http://stackoverflow.com/questions/1397182/stream-ftp-download-to-output
An implementation seems to be working well (although we are still testing it.) Only difference being we used STREAM_PF_INET in stream_socket_pair function call.
On Mon, May 30, 2016 at 8:16 PM, Christophe Coevoet < notifications@github.com> wrote:
@anvaya https://github.com/anvaya if your needs are only about FTP rather than about using the Gaufrette API, you could use ftp_fget calls directly to perform reads, as it reads to a PHP stream (and ftp_fput also reads from a stream)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/KnpLabs/Gaufrette/issues/416#issuecomment-222507544, or mute the thread https://github.com/notifications/unsubscribe/ACyvJz2szCkfOqeVBMa9sTMW9pt7hmImks5qGvhGgaJpZM4Ip1JW .
The Ftp Adapter methods are not ideal for large file read and write.
Write Method => Has parameter $content, for a large file this means saving entire file contents in a variable and then send to this method. Does not seem to support either file path or open handle.
Read Method => Again downloads the entire file to the server from remote FTP server, and then reads the contents into a variable. This is problematic for large files which are essentially need to be streamed to the client browser.
Suggestions:
If the functionality already exists, please let us know.