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

Method status

lib/protocol/SFTP.js:1865–1897  ·  view source on GitHub ↗
(reqid, code, message)

Source from the content-addressed store, hash-verified

1863 );
1864 }
1865 status(reqid, code, message) {
1866 if (!this.server)
1867 throw new Error('Server-only method called in client mode');
1868
1869 if (!VALID_STATUS_CODES.has(code))
1870 throw new Error(`Bad status code: ${code}`);
1871
1872 message || (message = '');
1873
1874 const msgLen = Buffer.byteLength(message);
1875 let p = 9;
1876 const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + 4 + msgLen + 4);
1877
1878 writeUInt32BE(buf, buf.length - 4, 0);
1879 buf[4] = RESPONSE.STATUS;
1880 writeUInt32BE(buf, reqid, 5);
1881
1882 writeUInt32BE(buf, code, p);
1883
1884 writeUInt32BE(buf, msgLen, p += 4);
1885 p += 4;
1886 if (msgLen) {
1887 buf.utf8Write(message, p, msgLen);
1888 p += msgLen;
1889 }
1890
1891 writeUInt32BE(buf, 0, p); // Empty language tag
1892
1893 const isBuffered = sendOrBuffer(this, buf);
1894 this._debug && this._debug(
1895 `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} STATUS`
1896 );
1897 }
1898 data(reqid, data, encoding) {
1899 if (!this.server)
1900 throw new Error('Server-only method called in client mode');

Callers 4

SFTP.jsFile · 0.80
test-sftp.jsFile · 0.80
onSTATFunction · 0.80

Calls 2

writeUInt32BEFunction · 0.85
sendOrBufferFunction · 0.85

Tested by

no test coverage detected