MCPcopy Create free account
hub / github.com/nodejs/node / bindAsyncResource

Function bindAsyncResource

lib/internal/streams/end-of-stream.js:62–68  ·  view source on GitHub ↗
(fn, type)

Source from the content-addressed store, hash-verified

60const nop = () => {};
61
62function bindAsyncResource(fn, type) {
63 AsyncResource ??= require('async_hooks').AsyncResource;
64 const resource = new AsyncResource(type);
65 return function(...args) {
66 return resource.runInAsyncScope(fn, this, ...args);
67 };
68}
69
70/**
71 * Returns the current stream error tracked by eos(), if any.

Callers 2

eosFunction · 0.85
eosWebFunction · 0.85

Calls 2

runInAsyncScopeMethod · 0.95
requireFunction · 0.50

Tested by

no test coverage detected