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.

Zero length files using `.get()` with `2.5.0`

See original GitHub issue

I’m running node v8.15.1.

Noticed my files were coming down as zero byte files since March 30th 2019 when we did a release.

checked the logs and saw this error:

(node:10933) UnhandledPromiseRejectionWarning: TypeError: stream.pipe is not a function

Code at this point looks like this:

await this.sftp.get(remote_filename).then((stream) => {
  stream.pipe(fs.createWriteStream(local_path));
});

So there is no .pipe() on the stream object at this point for some reason. I did a console log on the stream object and it is a Buffer.

Checked the ssh2-sftp-client version and we were running 2.5.0.

Downgraded to 2.4.3 and the problem resolved itself.

I’m not sure what changed between 2.4.3 and 2.5.0, but clearly it broke my code.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
theophilusxcommented, Aug 22, 2019

The next release which alters API ini any way will have a new major version number. This will also be the practice for all future releases.

0reactions
theophilusxcommented, Jul 3, 2019

Agree that the version should have been increased to 3.x.y because the changes broke the existing API. This was in the PR, but did not occur - don’t know why.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class: File (Ruby 2.5.0)
A File is an abstraction of any file object accessible by the program and is closely ... Returns true if the named file...
Read more >
Rails sends 0 byte files using send_file - Stack Overflow
I can't get send_file(Model.attachment.path) to work. It doesn't fail, instead, it sends a 0 byte size file to the client, the file names...
Read more >
How can I list only non-empty files using ls? - Super User
I'd use find dirname -not -empty -ls , assuming GNU find. ... -size +0 this tells find to look for files with size...
Read more >
Very specific set of circumstances leads to zero-byte (empty ...
If all 4 are false, the file is created but it has a 0-byte size. I've checked to see if the source filesystem...
Read more >
What are zero-byte files and how do I deal with them?
A zero-byte file is a file that does not contain any data. While most files contain several bytes, kilobytes (thousands of bytes) or...
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