question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems with BRICKftp (files.com) server interactions. [Was: The put and fastPut methods have limits in maximum file size]

See original GitHub issue

Like 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:closed
  • Created 4 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
theophilusxcommented, Sep 11, 2019

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!

0reactions
theophilusxcommented, Sep 14, 2019

Fixed upstream.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found