How to use the ssh2.SFTP_STATUS_CODE.EOF function in ssh2

To help you get started, we’ve selected a few ssh2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github silexlabs / unifile / test / unifile-sftp.js View on Github external
.on('READ', (reqid, handle, offset, length) => {
							const path = handle.toString();
							if(reading) {
								reading = false;
								return sftpStream.status(reqid, SFTP_STATUS_CODE.EOF);
							}
							reading = true;
							if(path === 'empty') sftpStream.data(reqid, null);
							else Fs.readFilePromised(handle.toString())
							.then((data) => sftpStream.data(reqid, data))
							.catch((e) => {
								if(e.code === 'ENOENT')
									sftpStream.status(reqid, SFTP_STATUS_CODE.NO_SUCH_FILE);
								else
									sftpStream.status(reqid, SFTP_STATUS_CODE.FAILURE);
							});
						})
						.on('WRITE', (reqid, handle, offset, data) => {