(stream, cb, err)
| 3805 | }; |
| 3806 | |
| 3807 | function closeStream(stream, cb, err) { |
| 3808 | if (!stream.handle) |
| 3809 | return onclose(); |
| 3810 | |
| 3811 | stream.sftp.close(stream.handle, onclose); |
| 3812 | |
| 3813 | function onclose(er) { |
| 3814 | er = er || err; |
| 3815 | cb(er); |
| 3816 | stream.isClosed = true; |
| 3817 | if (!er) |
| 3818 | stream.emit('close'); |
| 3819 | } |
| 3820 | } |
| 3821 | |
| 3822 | ReadStream.prototype.close = function(cb) { |
| 3823 | this.destroy(null, cb); |