(path, cb)
| 980 | ); |
| 981 | } |
| 982 | stat(path, cb) { |
| 983 | if (this.server) |
| 984 | throw new Error('Client-only method called in server mode'); |
| 985 | |
| 986 | /* |
| 987 | uint32 id |
| 988 | string path |
| 989 | */ |
| 990 | const pathLen = Buffer.byteLength(path); |
| 991 | let p = 9; |
| 992 | const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen); |
| 993 | |
| 994 | writeUInt32BE(buf, buf.length - 4, 0); |
| 995 | buf[4] = REQUEST.STAT; |
| 996 | const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; |
| 997 | writeUInt32BE(buf, reqid, 5); |
| 998 | |
| 999 | writeUInt32BE(buf, pathLen, p); |
| 1000 | buf.utf8Write(path, p += 4, pathLen); |
| 1001 | |
| 1002 | this._requests[reqid] = { cb }; |
| 1003 | |
| 1004 | const isBuffered = sendOrBuffer(this, buf); |
| 1005 | this._debug && this._debug( |
| 1006 | `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} STAT` |
| 1007 | ); |
| 1008 | } |
| 1009 | lstat(path, cb) { |
| 1010 | if (this.server) |
| 1011 | throw new Error('Client-only method called in server mode'); |
no test coverage detected