MCPcopy
hub / github.com/di-sukharev/opencommit / read

Method read

out/cli.cjs:10823–10843  ·  view source on GitHub ↗

* Returns a promise that allows access to the next chunk from the stream's internal queue, if available. * * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.

()

Source from the content-addressed store, hash-verified

10821 * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
10822 */
10823 read() {
10824 if (!IsReadableStreamDefaultReader(this)) {
10825 return promiseRejectedWith(defaultReaderBrandCheckException("read"));
10826 }
10827 if (this._ownerReadableStream === void 0) {
10828 return promiseRejectedWith(readerLockException("read from"));
10829 }
10830 let resolvePromise;
10831 let rejectPromise;
10832 const promise = newPromise((resolve, reject) => {
10833 resolvePromise = resolve;
10834 rejectPromise = reject;
10835 });
10836 const readRequest = {
10837 _chunkSteps: (chunk) => resolvePromise({ value: chunk, done: false }),
10838 _closeSteps: () => resolvePromise({ value: void 0, done: true }),
10839 _errorSteps: (e3) => rejectPromise(e3)
10840 };
10841 ReadableStreamDefaultReaderRead(this, readRequest);
10842 return promise;
10843 }
10844 /**
10845 * Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.
10846 * If the associated stream is errored when the lock is released, the reader will appear errored in the same way

Callers

nothing calls this directly

Calls 7

promiseRejectedWithFunction · 0.85
readerLockExceptionFunction · 0.85
newPromiseFunction · 0.85
rejectPromiseFunction · 0.85

Tested by

no test coverage detected