Problems with BRICKftp (files.com) server interactions. [Was: The put and fastPut methods have limits in maximum file size]
See original GitHub issueLike in the https://github.com/jyu213/ssh2-sftp-client/issues/140 is mentioned, these methods don’t work for files > 100kB. But they should work out of the box.
Putting the file content into the readable stream is a workaround, it should be possible to use just sftp.put( src, dest );
. Now you need to do something like this instead:
const { Readable } = require( 'stream' );
const fileBody = ( await fs.readFile( src ) ).toString();
await sftp.put( new ReadableStringStream( fileBody ), dest );
class ReadableStringStream extends Readable {
constructor( str, options ) {
super( options );
this.str = str;
}
_read( size ) {
const chunk = this.str.slice( 0, size );
if ( chunk ) {
this.str = this.str.slice( size );
this.push( chunk );
} else {
this.push( null );
}
}
}
This happens with node 8. Not sure if it crashes also with other node versions.
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (9 by maintainers)
Top Results From Across the Web
Developers - Problems with BRICKftp (files.com) server interactions ...
Problems with BRICKftp (files.com) server interactions. [Was: The put and fastPut methods have limits in maximum file size]
Read more >SFTP Fastput not uploading the file contents - Stack Overflow
I cannot debug why files does not show up in FTP. Any thoughts how to debug the issue ? I tried with SFTP.put...
Read more >SFTP - Files.com
SFTP has no maximum file size limitation, nor any limitation about the number of files that can be transferred. It is one of...
Read more >Max FTP upload file size - Web Hosting Talk
Standard LAMP with user accounts (mod_userdir)? Regular "average Joe" file server? No cPanel or other user interface? If you're on an OpenVZ VPS ......
Read more >MFT not returning error for file transfer failure - webMethods
Hello Everyone, In my current organization we use the concept of SFTP tunneling through MFT VFS for file transfers to target SFTP servers....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, so from that, it is likely something specific to the SFTP server. I have tested against a number of differrent sftp servers and those tests all pass. Given that put works, it is likely something related to the concurrency aspect of fastput. Will be interesting to see if just using the ssh2 streams lib gives the same error (I suspect it will). BTW some of the other tests are failing because the setup hooks also used ssh2-sftp-client and fastPut. I have been working on an lftp wrapper which will make the setup/cleanup independent from the module being tested, but it is still a work in progress!
Fixed upstream.