नोडज में, जब मैं एक req वस्तु को console.log करता हूं, [परिपत्र] का क्या अर्थ है?नोडजेस में, जब मैं एक req वस्तु को console.log जोड़ता हूं, [परिपत्र] संदर्भ क्या करता है? यह निर्धारित करने के लिए कि
यहां एक मूल नोडज उदाहरण के खिलाफ एक उदाहरण console.log (req) है। Request.socket._readWatcher.socket पर ध्यान दें [परिपत्र] है। क्या इसका मतलब यह है कि यह खुद को संदर्भित करता है? मैं इसे कैसे रोक सकता हूं?
{ socket:
{ bufferSize: 0,
fd: 7,
type: 'tcp4',
allowHalfOpen: true,
_readWatcher:
{ socket: [Circular],
callback: [Function: onReadable] },
destroyed: false,
readable: true,
_writeQueue: [],
_writeQueueEncoding: [],
_writeQueueFD: [],
_writeQueueCallbacks: [],
_writeWatcher:
{ socket: [Circular],
callback: [Function: onWritable] },
writable: true,
_writeImpl: [Function],
_readImpl: [Function],
_shutdownImpl: [Function],
remoteAddress: '127.0.1.1',
remotePort: 40407,
server:
{ connections: 1,
allowHalfOpen: true,
watcher: [Object],
_events: [Object],
httpAllowHalfOpen: false,
type: 'tcp4',
fd: 5 },
ondrain: [Function],
_idleTimeout: 120000,
_idleNext:
{ repeat: 120,
_idleNext: [Circular],
_idlePrev: [Circular],
callback: [Function] },
_idlePrev:
{ repeat: 120,
_idleNext: [Circular],
_idlePrev: [Circular],
callback: [Function] },
_idleStart: Sun, 15 May 2011 01:18:50 GMT,
_events:
{ timeout: [Function],
error: [Function],
close: [Function] },
ondata: [Function],
onend: [Function],
_httpMessage:
{ output: [],
outputEncodings: [],
writable: true,
_last: false,
chunkedEncoding: true,
shouldKeepAlive: true,
useChunkedEncodingByDefault: true,
_hasBody: true,
_trailer: '',
finished: false,
socket: [Circular],
connection: [Circular],
_events: [Object],
_header: 'HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n',
_headerSent: false } },
connection:
{ bufferSize: 0,
fd: 7,
type: 'tcp4',
allowHalfOpen: true,
_readWatcher:
{ socket: [Circular],
callback: [Function: onReadable] },
destroyed: false,
readable: true,
_writeQueue: [],
_writeQueueEncoding: [],
_writeQueueFD: [],
_writeQueueCallbacks: [],
_writeWatcher:
{ socket: [Circular],
callback: [Function: onWritable] },
writable: true,
_writeImpl: [Function],
_readImpl: [Function],
_shutdownImpl: [Function],
remoteAddress: '127.0.1.1',
remotePort: 40407,
server:
{ connections: 1,
allowHalfOpen: true,
watcher: [Object],
_events: [Object],
httpAllowHalfOpen: false,
type: 'tcp4',
fd: 5 },
ondrain: [Function],
_idleTimeout: 120000,
_idleNext:
{ repeat: 120,
_idleNext: [Circular],
_idlePrev: [Circular],
callback: [Function] },
_idlePrev:
{ repeat: 120,
_idleNext: [Circular],
_idlePrev: [Circular],
callback: [Function] },
_idleStart: Sun, 15 May 2011 01:18:50 GMT,
_events:
{ timeout: [Function],
error: [Function],
close: [Function] },
ondata: [Function],
onend: [Function],
_httpMessage:
{ output: [],
outputEncodings: [],
writable: true,
_last: false,
chunkedEncoding: true,
shouldKeepAlive: true,
useChunkedEncodingByDefault: true,
_hasBody: true,
_trailer: '',
finished: false,
socket: [Circular],
connection: [Circular],
_events: [Object],
_header: 'HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n',
_headerSent: false } },
httpVersion: '1.1',
complete: false,
headers:
{ 'user-agent': 'curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18',
host: 'uh-uh-uh-I-aint-telling',
accept: '*/*' },
trailers: {},
readable: true,
url: '/',
method: 'GET',
statusCode: null,
client:
{ bufferSize: 0,
fd: 7,
type: 'tcp4',
allowHalfOpen: true,
_readWatcher:
{ socket: [Circular],
callback: [Function: onReadable] },
destroyed: false,
readable: true,
_writeQueue: [],
_writeQueueEncoding: [],
_writeQueueFD: [],
_writeQueueCallbacks: [],
_writeWatcher:
{ socket: [Circular],
callback: [Function: onWritable] },
writable: true,
_writeImpl: [Function],
_readImpl: [Function],
_shutdownImpl: [Function],
remoteAddress: '127.0.1.1',
remotePort: 40407,
server:
{ connections: 1,
allowHalfOpen: true,
watcher: [Object],
_events: [Object],
httpAllowHalfOpen: false,
type: 'tcp4',
fd: 5 },
ondrain: [Function],
_idleTimeout: 120000,
_idleNext:
{ repeat: 120,
_idleNext: [Circular],
_idlePrev: [Circular],
callback: [Function] },
_idlePrev:
{ repeat: 120,
_idleNext: [Circular],
_idlePrev: [Circular],
callback: [Function] },
_idleStart: Sun, 15 May 2011 01:18:50 GMT,
_events:
{ timeout: [Function],
error: [Function],
close: [Function] },
ondata: [Function],
onend: [Function],
_httpMessage:
{ output: [],
outputEncodings: [],
writable: true,
_last: false,
chunkedEncoding: true,
shouldKeepAlive: true,
useChunkedEncodingByDefault: true,
_hasBody: true,
_trailer: '',
finished: false,
socket: [Circular],
connection: [Circular],
_events: [Object],
_header: 'HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n',
_headerSent: false } },
httpVersionMajor: 1,
httpVersionMinor: 1,
upgrade: false }
अद्यतन
जब से मैं जाहिरा तौर पर के रूप में स्पष्ट रूप में मैं हो सकता था नहीं था, कैसे मैं क्या तत्व भिन्नता चक्राकार संदर्भित किया जा रहा है कर सकते हैं? क्या यह हमेशा मूल तत्व है?
ध्यान दें, कल रात मैंने यूटिल क्लास और निरीक्षण विधि के बारे में सीखा। जो मुझे शायद इस बारे में अधिक जानकारी दे सकता है, मुझे उचित रूप से जानना चाहिए;)
+1 4 परतों के लिए मुझे गहराई से जाने के लिए +1। – Raynos
@ रेनोस मूल रूप से मैंने चीज़ को आउटपुट करने के लिए एक वीआईएम मैक्रो लिखने की योजना बनाई लेकिन मुझे डर था कि यह मेरे अद्भुत संपादक को दुर्घटनाग्रस्त कर सकता है ... –
नहीं, यह एक परिपत्र संदर्भ क्या है (मुझे और अधिक विशिष्ट होना चाहिए) – jcolebrand