(path, cb)
| 1034 | ); |
| 1035 | } |
| 1036 | opendir(path, cb) { |
| 1037 | if (this.server) |
| 1038 | throw new Error('Client-only method called in server mode'); |
| 1039 | |
| 1040 | /* |
| 1041 | uint32 id |
| 1042 | string path |
| 1043 | */ |
| 1044 | const pathLen = Buffer.byteLength(path); |
| 1045 | let p = 9; |
| 1046 | const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen); |
| 1047 | |
| 1048 | writeUInt32BE(buf, buf.length - 4, 0); |
| 1049 | buf[4] = REQUEST.OPENDIR; |
| 1050 | const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; |
| 1051 | writeUInt32BE(buf, reqid, 5); |
| 1052 | |
| 1053 | writeUInt32BE(buf, pathLen, p); |
| 1054 | buf.utf8Write(path, p += 4, pathLen); |
| 1055 | |
| 1056 | this._requests[reqid] = { cb }; |
| 1057 | |
| 1058 | const isBuffered = sendOrBuffer(this, buf); |
| 1059 | this._debug && this._debug( |
| 1060 | `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} OPENDIR` |
| 1061 | ); |
| 1062 | } |
| 1063 | setstat(path, attrs, cb) { |
| 1064 | if (this.server) |
| 1065 | throw new Error('Client-only method called in server mode'); |
no test coverage detected