Baseline Widely available *
Streams APIì ReadableStream
ì¸í°íì´ì¤ë ë°ì´í¸ ë°ì´í°ë¥¼ ì½ìì ìë ì¤í¸ë¦¼ì ì ê³µí©ëë¤. Fetch APIë Response ê°ì²´ì body ìì±ì íµíì¬ ReadableStream
ì 구체ì ì¸ ì¸ì¤í´ì¤ë¥¼ ì ê³µí©ëë¤.
ReadableStream()
ì½ìì ìë ì¤í¸ë¦¼ ê°ì²´ë¥¼ ìì±íê³ ë¦¬í´í©ëë¤.
ReadableStream.locked
ì½ê¸° ì ì©
locked
ë Readable streamì´ readerì ê³ ì ëì´ ìëì§(locaked to a reader) íì¸íë getter ì
ëë¤.
ReadableStream.cancel()
ì¤í¸ë¦¼ì ì·¨ìíì¬, ìë¹ìê° ì¤í¸ë¦¼ì ëí´ ê´ì¬ì´ ììì ì립ëë¤. The supplied reason argument will be given to the underlying source, which may or may not use it.
ReadableStream.getReader()
Reader를 ë§ë¤ê³ ì¤í¸ë¦¼ì ê·¸ Readerì ê³ ì ìíµëë¤. ì¤í¸ë¦¼ì´ ê³ ì ëì´ ìë ëììë ë¤ë¥¸ Reader를 ì»ìì ììµëë¤.
ReadableStream.pipeThrough()
Provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.
ReadableStream.pipeTo()
ì¸ìë¡ ë기ë WritableStream
ê³¼ íì¬ì ReadableStreamì ì°ê²°íê³ íë¡ë¯¸ì¤ë¥¼ 리í´í©ëë¤. ì´ íë¡ë¯¸ì¤ë íì´í íë¡ì¸ì¤ê° ì±ê³µì ì¼ë¡ ìë£ë ë fulfilëë©° ì ë¬ê° ë°ìíìë rejectë©ëë¤.
ReadableStream.tee()
The tee
method tees this readable stream, returning a two-element array containing the two resulting branches as new ReadableStream
instances. Each of those streams receives the same incoming data.
ìë ìììì, ë¤ë¥¸ 리ìì¤ìì fetchë HTML ì¡°ê°ë¤ì ì¤í¸ë¦¼ í기ìí´ ê°ê³µì Response
를 ë§ëëë¤. ì´ê²ìUint8Array
ë¡ êµ¬ì±ë ReadableStream
ì ì¬ì©ë²ì ë³´ì¬ì¤ëë¤.
fetch("https://www.example.org/").then((response) => {
const reader = response.body.getReader();
const stream = new ReadableStream({
start(controller) {
// ìë í¨ìë ê° data chunck를 ë¤ë£¬ë¤.
function push() {
// "done"ì Boolean ì´ë©° valueë "Uint8Array ì´ë¤."
reader.read().then(({ done, value }) => {
// ëì´ì ì½ì ë°ì´í°ê° ìëê°?
if (done) {
// ë¸ë¼ì°ì ìê² ë°ì´í° ì ë¬ì´ ëë¬ë¤ê³ ì린ë¤.
controller.close();
return;
}
// ë°ì´í°ë¥¼ ì»ê³ 컨í¸ë¡¤ë¬ë¥¼ íµíì¬ ê·¸ ë°ì´í°ë¥¼ ë¸ë¼ì°ì ì ë긴ë¤.
controller.enqueue(value);
push();
});
}
push();
},
});
return new Response(stream, { headers: { "Content-Type": "text/html" } });
});
ëª
ì¸ì ë¸ë¼ì°ì í¸íì± See Also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4