MCPcopy Create free account
hub / github.com/mscdex/ssh2 / fstat

Method fstat

lib/protocol/SFTP.js:952–981  ·  view source on GitHub ↗
(handle, cb)

Source from the content-addressed store, hash-verified

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');

Callers 5

readFileMethod · 0.95
writeFileMethod · 0.95
fastXferFunction · 0.80
tryAgainFunction · 0.80
test-sftp.jsFile · 0.80

Calls 2

writeUInt32BEFunction · 0.85
sendOrBufferFunction · 0.85

Tested by

no test coverage detected