Zero length files using `.get()` with `2.5.0`
See original GitHub issueI’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:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top 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 >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
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.
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.