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

Function shareSync

lib/internal/streams/iter/share.js:682–700  ·  view source on GitHub ↗
(source, options = { __proto__: null })

Source from the content-addressed store, hash-verified

680}
681
682function shareSync(source, options = { __proto__: null }) {
683 // Normalize source via fromSync() - accepts strings, ArrayBuffers, protocols, etc.
684 const normalized = fromSync(source);
685 validateObject(options, 'options');
686 const {
687 highWaterMark = kMultiConsumerDefaultHWM,
688 backpressure = 'strict',
689 } = options;
690 validateInteger(highWaterMark, 'options.highWaterMark');
691 validateBackpressure(backpressure);
692
693 const opts = {
694 __proto__: null,
695 highWaterMark: clampHWM(highWaterMark),
696 backpressure,
697 };
698
699 return new SyncShareImpl(normalized, opts);
700}
701
702function isShareable(value) {
703 return hasProtocol(value, shareProtocol);

Callers 13

fromSyncFunction · 0.85
[shareSyncProtocol]Function · 0.85
testSyncShareDisposeFunction · 0.85
testSyncIteratorThrowFunction · 0.85
testShareSyncBasicFunction · 0.85
testShareSyncCancelFunction · 0.85
testShareSyncSourceErrorFunction · 0.85

Calls 3

validateBackpressureFunction · 0.85
clampHWMFunction · 0.85
fromSyncFunction · 0.70

Tested by

no test coverage detected