Closed jeffrson closed 3 years ago
AFAICT after some research, the difference between read & readData is caused by SSH2.sftp returning an SFTPWrapper, which uses read
instead of readData
and write
instead of writeData
.
Please check the PR and release a new version on npm!
BTW, the tests cannot be run, because it's missing a file:
yarn run test yarn run v1.16.0 $ ts-node node_modules/jasmine/bin/jasmine Error: ENOENT: no such file or directory, open './spec/fixture.json' ...
@jeffrson
Sorry for late reply, got stuck with other work
Yes, test cannot be run right now, I am working on 'test' branch, which contain docker image, against which we could run our test cases
Currently, i am trying to integrate travis ci fully. Once, done, i will merge it with master.
Apart from this i didn't understand the 'read' and 'write' requirement. If you open below link https://github.com/mscdex/ssh2-streams/blob/master/SFTPStream.md
in this page, clearly, readData and writeData is being used, that's why i have used the same name.
Well, the problem is, your library isn't really using that SFTPStream.
Instead, in sshConnection (https://github.com/sanketbajoria/ssh2-promise/blob/master/src/sshConnection.ts#L85) it receives an instance of a class called SFTPWrapper (https://github.com/mscdex/ssh2/blob/master/lib/client.js#L888), which replaces readData/writeData by read/write, respectively (https://github.com/mscdex/ssh2/blob/master/lib/SFTPWrapper.js#L44).
Hence, readData/writeData don't exist in sftp(), which it why it fails, when these are called.
I'm sorry the initial post is a bit confusing. But at that time I didn't know enough about the background. Just using "readData" had been failing for me.
Apparently there should be methods
readData
andwriteData
.I don't know, whether has SSH2 renamed these or why these methods don't exist. In any case it seems they should be called
read
andwrite
, respectively.This bug is critical, because
readData
/writeData
are unusable, as areread
/write
.BTW, what are
readFileData
andwriteFileData
?