(handle, cb)
| 950 | ); |
| 951 | } |
| 952 | fstat(handle, cb) { |
| 953 | if (this.server) |
| 954 | throw new Error('Client-only method called in server mode'); |
| 955 | |
| 956 | if (!Buffer.isBuffer(handle)) |
| 957 | throw new Error('handle is not a Buffer'); |
| 958 | |
| 959 | /* |
| 960 | uint32 id |
| 961 | string handle |
| 962 | */ |
| 963 | const handleLen = handle.length; |
| 964 | let p = 9; |
| 965 | const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + handleLen); |
| 966 | |
| 967 | writeUInt32BE(buf, buf.length - 4, 0); |
| 968 | buf[4] = REQUEST.FSTAT; |
| 969 | const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; |
| 970 | writeUInt32BE(buf, reqid, 5); |
| 971 | |
| 972 | writeUInt32BE(buf, handleLen, p); |
| 973 | buf.set(handle, p += 4); |
| 974 | |
| 975 | this._requests[reqid] = { cb }; |
| 976 | |
| 977 | const isBuffered = sendOrBuffer(this, buf); |
| 978 | this._debug && this._debug( |
| 979 | `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} FSTAT` |
| 980 | ); |
| 981 | } |
| 982 | stat(path, cb) { |
| 983 | if (this.server) |
| 984 | throw new Error('Client-only method called in server mode'); |
no test coverage detected