diff --git a/assets/highlight.css b/assets/highlight.css index f02152d1..4442e776 100644 --- a/assets/highlight.css +++ b/assets/highlight.css @@ -7,24 +7,30 @@ --dark-hl-2: #9CDCFE; --light-hl-3: #A31515; --dark-hl-3: #CE9178; - --light-hl-4: #008000; - --dark-hl-4: #6A9955; - --light-hl-5: #0000FF; - --dark-hl-5: #569CD6; - --light-hl-6: #0070C1; - --dark-hl-6: #4FC1FF; - --light-hl-7: #795E26; - --dark-hl-7: #DCDCAA; - --light-hl-8: #800000; - --dark-hl-8: #808080; + --light-hl-4: #0000FF; + --dark-hl-4: #569CD6; + --light-hl-5: #0070C1; + --dark-hl-5: #4FC1FF; + --light-hl-6: #795E26; + --dark-hl-6: #DCDCAA; + --light-hl-7: #098658; + --dark-hl-7: #B5CEA8; + --light-hl-8: #008000; + --dark-hl-8: #6A9955; --light-hl-9: #800000; - --dark-hl-9: #569CD6; - --light-hl-10: #000000FF; - --dark-hl-10: #D4D4D4; - --light-hl-11: #E50000; - --dark-hl-11: #9CDCFE; - --light-hl-12: #0000FF; - --dark-hl-12: #CE9178; + --dark-hl-9: #808080; + --light-hl-10: #800000; + --dark-hl-10: #569CD6; + --light-hl-11: #000000FF; + --dark-hl-11: #D4D4D4; + --light-hl-12: #E50000; + --dark-hl-12: #9CDCFE; + --light-hl-13: #0000FF; + --dark-hl-13: #CE9178; + --light-hl-14: #267F99; + --dark-hl-14: #4EC9B0; + --light-hl-15: #EE0000; + --dark-hl-15: #D7BA7D; --light-code-background: #FFFFFF; --dark-code-background: #1E1E1E; } @@ -43,6 +49,9 @@ --hl-10: var(--light-hl-10); --hl-11: var(--light-hl-11); --hl-12: var(--light-hl-12); + --hl-13: var(--light-hl-13); + --hl-14: var(--light-hl-14); + --hl-15: var(--light-hl-15); --code-background: var(--light-code-background); } } @@ -60,6 +69,9 @@ --hl-10: var(--dark-hl-10); --hl-11: var(--dark-hl-11); --hl-12: var(--dark-hl-12); + --hl-13: var(--dark-hl-13); + --hl-14: var(--dark-hl-14); + --hl-15: var(--dark-hl-15); --code-background: var(--dark-code-background); } } @@ -77,6 +89,9 @@ --hl-10: var(--light-hl-10); --hl-11: var(--light-hl-11); --hl-12: var(--light-hl-12); + --hl-13: var(--light-hl-13); + --hl-14: var(--light-hl-14); + --hl-15: var(--light-hl-15); --code-background: var(--light-code-background); } @@ -94,6 +109,9 @@ --hl-10: var(--dark-hl-10); --hl-11: var(--dark-hl-11); --hl-12: var(--dark-hl-12); + --hl-13: var(--dark-hl-13); + --hl-14: var(--dark-hl-14); + --hl-15: var(--dark-hl-15); --code-background: var(--dark-code-background); } @@ -110,4 +128,7 @@ .hl-10 { color: var(--hl-10); } .hl-11 { color: var(--hl-11); } .hl-12 { color: var(--hl-12); } +.hl-13 { color: var(--hl-13); } +.hl-14 { color: var(--hl-14); } +.hl-15 { color: var(--hl-15); } pre, code { background: var(--code-background); } diff --git a/assets/navigation.js b/assets/navigation.js index c5942166..ba07b734 100644 --- a/assets/navigation.js +++ b/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA42RQQsCIRBG/8ucpYWoPXgL6hgbdIwO6o6t1KroLASx/z2ILbJMOn/vPQY93IDwSsBhJV2gxpNxNgIDL6gDDsYSBi0UxuodmHXUX4DB2dgW+HxZj+wVWqNyLYZsY9pK+sb+1qetpG8xRnHCPQUUfTaSEKXULjhyctCFVor8H2s85R/5GytFvfy8TQ9WPX6oem6pXy/G4x0EzLHP9AEAAA==" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA62Z3W7cNhCF30XXVloHTdr6LnZSwEALC07RmyAQKGm0yyxXZEmq9aLIuxek/iWKHHl1PWc+HpIjciR9+S/S8KKjuyhjPIs1j6mObiJB9DG6i868qBmoH0ws1Tyl+s1Rn1l0E51oVUR3b2+i/EhZIaGK7r70qAJKUrMRp6yrXFNeTUitakp8/9P3r99vBlOS/6tAxhJIQTIGSksg51WbjTqdqjcYv28Az23+Z5v/J3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drUgPTWhL5Gyny8BdLdaLuFzYT2KGoLQZZ0oqvvB6ZAK6o+VkQCaGatryZ9vXdtaVhpyiY6weyoZgIapKfjTJwWje0sfKK+VkWcoKanNzHpAnsUE8Wg/XCY/d/fLdBnrr/bu/hepW9YSr2D9eqdRvdyWrDWrf29X/B5WM0viEAAA==" \ No newline at end of file diff --git a/assets/search.js b/assets/search.js index fd1f1238..f6ace46e 100644 --- a/assets/search.js +++ b/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA7VXW2+bMBT+LyevbsoxBBLeNnUPkzZ10qS+oGhygtOiEUDgXqYo/33iFtvBZqTpXio1/i7n5gsHKPPXCsLoAL+TLIbQ9whkbM8hhGLzU5Sc7YHAc5lCCLvnbCuSPKtu+6X5k9inQGCbsqriFYQAR9JL0YV/0vq0yUtxXzTsk16SCV7u2JZXt+r6qCg6VEZYJY8ZSyfpzU5YRZZAwUqeifMAzTnc8W0e89Jk1y1NLseXzCrVLU2W+lHmIt887856pSjqiHFhx1uelEvO4ol6sw5rru1ZiBa71zIRfKpfD77a8OEix4crLYvNVLsGeY3Vc/ZasmKq3Ql9qaUyid95VbFHbh9EDXD9HA7lxsdQj+/SKTS4jQ/hdDvjDNr87CM4ydA+FgbDf0yF1dB6PN0Xwnj8D1HTxyPl2aN4GjlRLeKzc6K0ElV8k1Q3SfbE65LH9q3QJDQa2MitMR6YJH5AYNq1uWdv3xqL9u8loQ2p/yG4OybYu0LTiB8d2J+Ep/HnP4JfMsEzjfX+kNYEkizmbxAe4IWXVZJnEAKdu/MVENjVJvUrro2VwDbf72uxdbf2wLciL2tEC7l1gEQOocHcXa9J1OObn5sfGhACiXAIQg1EgUR0CKIayAUSuUOQq4E8IJE3BHkaaAEkWgxBCw3kA4l8QukcV1SD+RosABIFJligwZZAoqUJttRgKyDRahjZSi9pXWF0TGp4Vvym+qby6/VHaksW9R6ga0sX9T6gZ0sY9V7gwp6M3hCsC4+GMUG9I1hXHg2TgnpLsC49GoYF9Z5gXX00zAvqbaFNW3zDGOtNoU1TAgOubUqzTV94KXj8td2uUQSs/rTI+2+fA/zqdjL2R8sBEMLD8Sj3bf1fLR/3d4BkuZLlWlg8G7A8yfIsrPbWMTiiQsblKNvgjErAGFjYe/YWM8HS7uxW2L5kU8fObpkG/kJxX9n47Tum6h6uClttka1H9UtdUlaSYbMrNkMnR9JsWRbdtTAkKzkuJpHz5hmm5EmVPH2LRPu2liSlMw2FAFILtf/2lmTF0EbqH59KmEqV0Ok8bRl3j3PJDiQ56Li2DdRwX1TyUpKXHdm2j5obf9Pe+Ersij01jtKaQJEUPE0yDmG0Ph7/ApH0BE+cEQAA"; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA81dXY/bSK79L/ar2iuWvvM2k90FBtiLCWYW89IIGmpbnXjjtr2yOpO+Qf77RZVKElkmpZLt3r3AAPG0i+RhHZJVRX34+6I+/HlavLv/vviy3W8W71Sw2JfP1eLd4nF3eLxrDnfbZhEsXurd4t3i+bB52VWnv+ivHprDw7ZZfW6ed4tgsd6Vp1N1WrxbLH4Ena407pVtqqfyZTdoenrZr5vtYU902UGMzmBxLOtq31BYgyWEWvtT1Xd1VW7Kx111auqqfJb8aAc/0MEenqkk7S3+3Cr5zer43ej45+GX5tej8bC3ut03Vf1UrqcMTymcmJ+xCRg8gFAN7Bzr6mu1b96X+3W1exu8S9fGfPSThmaH3phXfsHoN9lDeG6bu3K3OwvEbfNQ7nbXJ5PV44XdQhFQPpbN+jOH03xxE6StJl+sLaAxtNXm7vG1qU4i6mrzYAZ4p/ZPp9f9+udW9GctOZLSZ0YkYT9Pe2eElD1t/7e6HsbSqhmwNKfN3fZ0t91/ruptU23GsIm6JdCv22q3+empqeobQCfK/CbTB7DE/6+P/6rWzcURQMX/izHAALlhFDizdPs44OALkXB7J1QY58PsV/W23N2MAqTtTV3AO5cLK9t/v6j517PRGfOvBJcXgf8P+f9mqf+GCTM7V64COmvP0mOctXdh2K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8tHZvI0ZZgDyPu/Njd3KETqF4RcS4sW7fKIN9wQGRSOVvEKbhFOJoTPoToBRX9lXGyCdUGGIbRn33qs9JMRmNvq9kk4EmuT9/Qn/okkqEeS1s+eR2vUhfqHNuTMXZdYwIhUrcNRB7rlhdH4PFcXusdtt9tXh3//HHj/8DRn3CHBOXAAA="; \ No newline at end of file diff --git a/classes/it_byte_stream.AbortError.html b/classes/it_byte_stream.AbortError.html new file mode 100644 index 00000000..58b80aeb --- /dev/null +++ b/classes/it_byte_stream.AbortError.html @@ -0,0 +1,14 @@ +AbortError | Documentation

Hierarchy (view full)

Constructors

Properties

cause?: unknown
code: string
message: string
name: string
stack?: string
type: string
prepareStackTrace?: ((err, stackTraces) => any)

Optional override for formatting stack traces

+

Type declaration

    • (err, stackTraces): any
    • Parameters

      Returns any

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    +

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

\ No newline at end of file diff --git a/classes/it_byte_stream.CodeError.html b/classes/it_byte_stream.CodeError.html new file mode 100644 index 00000000..805078af --- /dev/null +++ b/classes/it_byte_stream.CodeError.html @@ -0,0 +1,13 @@ +CodeError | Documentation

Hierarchy (view full)

Constructors

Properties

cause?: unknown
code: string
message: string
name: string
stack?: string
prepareStackTrace?: ((err, stackTraces) => any)

Optional override for formatting stack traces

+

Type declaration

    • (err, stackTraces): any
    • Parameters

      Returns any

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    +

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

\ No newline at end of file diff --git a/functions/blob_to_it.default.html b/functions/blob_to_it.default.html new file mode 100644 index 00000000..01685bc2 --- /dev/null +++ b/functions/blob_to_it.default.html @@ -0,0 +1 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/browser_readablestream_to_it.default.html b/functions/browser_readablestream_to_it.default.html new file mode 100644 index 00000000..e7d601d3 --- /dev/null +++ b/functions/browser_readablestream_to_it.default.html @@ -0,0 +1,6 @@ +default | Documentation
  • Turns a browser readable stream into an async iterable. Async iteration over +returned iterable will lock give stream, preventing any other consumer from +acquiring a reader. The lock will be released if iteration loop is broken. To +prevent stream cancelling optional { preventCancel: true } could be passed +as a second argument.

    +

    Type Parameters

    • T

    Parameters

    Returns AsyncGenerator<T, void, undefined>

\ No newline at end of file diff --git a/functions/it_all.default.html b/functions/it_all.default.html new file mode 100644 index 00000000..6602e2b2 --- /dev/null +++ b/functions/it_all.default.html @@ -0,0 +1,2 @@ +default | Documentation
  • Collects all values from an (async) iterable and returns them as an array

    +

    Type Parameters

    • T

    Parameters

    Returns T[]

  • Type Parameters

    • T

    Parameters

    Returns Promise<T[]>

\ No newline at end of file diff --git a/functions/it_batch.default.html b/functions/it_batch.default.html new file mode 100644 index 00000000..c2d2aee8 --- /dev/null +++ b/functions/it_batch.default.html @@ -0,0 +1,3 @@ +default | Documentation
  • Takes an (async) iterable that emits things and returns an async iterable that +emits those things in fixed-sized batches

    +

    Type Parameters

    • T

    Parameters

    Returns Generator<T[], void, undefined>

  • Type Parameters

    • T

    Parameters

    • source: Iterable<T> | AsyncIterable<T>
    • Optional size: number

    Returns AsyncGenerator<T[], void, undefined>

\ No newline at end of file diff --git a/functions/it_batched_bytes.default.html b/functions/it_batched_bytes.default.html new file mode 100644 index 00000000..ce1a61b7 --- /dev/null +++ b/functions/it_batched_bytes.default.html @@ -0,0 +1,4 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/it_buffer_stream.default.html b/functions/it_buffer_stream.default.html new file mode 100644 index 00000000..6dfdae9e --- /dev/null +++ b/functions/it_buffer_stream.default.html @@ -0,0 +1,2 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/it_byte_stream.byteStream-1.html b/functions/it_byte_stream.byteStream-1.html new file mode 100644 index 00000000..85c5b648 --- /dev/null +++ b/functions/it_byte_stream.byteStream-1.html @@ -0,0 +1 @@ +byteStream | Documentation
\ No newline at end of file diff --git a/functions/it_drain.default.html b/functions/it_drain.default.html new file mode 100644 index 00000000..9af45818 --- /dev/null +++ b/functions/it_drain.default.html @@ -0,0 +1,3 @@ +default | Documentation
  • Drains an (async) iterable discarding its' content and does not return +anything

    +

    Parameters

    Returns void

  • Parameters

    • source: Iterable<unknown> | AsyncIterable<unknown>

    Returns Promise<void>

\ No newline at end of file diff --git a/functions/it_filter.default.html b/functions/it_filter.default.html new file mode 100644 index 00000000..63f82205 --- /dev/null +++ b/functions/it_filter.default.html @@ -0,0 +1,2 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/it_first.default.html b/functions/it_first.default.html new file mode 100644 index 00000000..f4d961c0 --- /dev/null +++ b/functions/it_first.default.html @@ -0,0 +1,3 @@ +default | Documentation
  • Returns the first result from an (async) iterable, unless empty, in which +case returns undefined

    +

    Type Parameters

    • T

    Parameters

    Returns T | undefined

  • Type Parameters

    • T

    Parameters

    Returns Promise<T | undefined>

\ No newline at end of file diff --git a/functions/it_flat_batch.default.html b/functions/it_flat_batch.default.html new file mode 100644 index 00000000..14c212e0 --- /dev/null +++ b/functions/it_flat_batch.default.html @@ -0,0 +1,3 @@ +default | Documentation
  • Takes an (async) iterable that emits variable length arrays of things and +returns an async iterable that emits those things in fixed-size batches

    +

    Type Parameters

    • T

    Parameters

    • source: Iterable<T[]>
    • Optional batchSize: number

    Returns Generator<T[], void, undefined>

  • Type Parameters

    • T

    Parameters

    • source: Iterable<T[]> | AsyncIterable<T[]>
    • Optional batchSize: number

    Returns AsyncGenerator<T[], void, undefined>

\ No newline at end of file diff --git a/functions/it_foreach.default.html b/functions/it_foreach.default.html new file mode 100644 index 00000000..8230185e --- /dev/null +++ b/functions/it_foreach.default.html @@ -0,0 +1,2 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/it_glob.default.html b/functions/it_glob.default.html new file mode 100644 index 00000000..c1ca17e9 --- /dev/null +++ b/functions/it_glob.default.html @@ -0,0 +1,2 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/it_last.default.html b/functions/it_last.default.html new file mode 100644 index 00000000..66cc0ed6 --- /dev/null +++ b/functions/it_last.default.html @@ -0,0 +1,3 @@ +default | Documentation
  • Returns the last item of an (async) iterable, unless empty, in which case +return undefined

    +

    Type Parameters

    • T

    Parameters

    Returns T | undefined

  • Type Parameters

    • T

    Parameters

    Returns Promise<T | undefined>

\ No newline at end of file diff --git a/functions/it_length.default.html b/functions/it_length.default.html new file mode 100644 index 00000000..25967b00 --- /dev/null +++ b/functions/it_length.default.html @@ -0,0 +1,2 @@ +default | Documentation
  • Consumes the passed iterator and returns the number of items it contained

    +

    Parameters

    Returns number

  • Parameters

    • source: Iterable<unknown> | AsyncIterable<unknown>

    Returns Promise<number>

\ No newline at end of file diff --git a/functions/it_length_prefixed_stream.lpStream.html b/functions/it_length_prefixed_stream.lpStream.html new file mode 100644 index 00000000..6b298780 --- /dev/null +++ b/functions/it_length_prefixed_stream.lpStream.html @@ -0,0 +1 @@ +lpStream | Documentation
\ No newline at end of file diff --git a/functions/it_map.default.html b/functions/it_map.default.html new file mode 100644 index 00000000..289c11b2 --- /dev/null +++ b/functions/it_map.default.html @@ -0,0 +1,3 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/it_merge.default.html b/functions/it_merge.default.html new file mode 100644 index 00000000..62b9959b --- /dev/null +++ b/functions/it_merge.default.html @@ -0,0 +1,4 @@ +default | Documentation
  • Treat one or more iterables as a single iterable.

    +

    Nb. sources are iterated over in parallel so the +order of emitted items is not guaranteed.

    +

    Type Parameters

    • T

    Parameters

    Returns Generator<T, void, undefined>

  • Type Parameters

    • T

    Parameters

    • Rest ...sources: (AsyncIterable<T> | Iterable<T>)[]

    Returns AsyncGenerator<T, void, undefined>

\ No newline at end of file diff --git a/functions/it_multipart.default.html b/functions/it_multipart.default.html new file mode 100644 index 00000000..1b66789c --- /dev/null +++ b/functions/it_multipart.default.html @@ -0,0 +1,2 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/it_ndjson.parse.html b/functions/it_ndjson.parse.html new file mode 100644 index 00000000..f8983d52 --- /dev/null +++ b/functions/it_ndjson.parse.html @@ -0,0 +1 @@ +parse | Documentation
\ No newline at end of file diff --git a/functions/it_ndjson.stringify.html b/functions/it_ndjson.stringify.html new file mode 100644 index 00000000..776d190a --- /dev/null +++ b/functions/it_ndjson.stringify.html @@ -0,0 +1 @@ +stringify | Documentation
\ No newline at end of file diff --git a/functions/it_parallel.default.html b/functions/it_parallel.default.html new file mode 100644 index 00000000..cdbafa19 --- /dev/null +++ b/functions/it_parallel.default.html @@ -0,0 +1,4 @@ +default | Documentation
  • Takes an (async) iterator that emits promise-returning functions, +invokes them in parallel and emits the results as they become available but +in the same order as the input

    +

    Type Parameters

    • T

    Parameters

    Returns AsyncGenerator<T, void, undefined>

\ No newline at end of file diff --git a/functions/it_parallel_batch.default.html b/functions/it_parallel_batch.default.html new file mode 100644 index 00000000..983711e7 --- /dev/null +++ b/functions/it_parallel_batch.default.html @@ -0,0 +1,4 @@ +default | Documentation
  • Takes an (async) iterator that emits promise-returning functions, +invokes them in parallel and emits the results as they become available but +in the same order as the input

    +

    Type Parameters

    • T

    Parameters

    Returns AsyncGenerator<T, void, undefined>

\ No newline at end of file diff --git a/functions/it_peekable.default.html b/functions/it_peekable.default.html new file mode 100644 index 00000000..e467c3fd --- /dev/null +++ b/functions/it_peekable.default.html @@ -0,0 +1 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/it_protobuf_stream.pbStream.html b/functions/it_protobuf_stream.pbStream.html new file mode 100644 index 00000000..3302c10d --- /dev/null +++ b/functions/it_protobuf_stream.pbStream.html @@ -0,0 +1 @@ +pbStream | Documentation
\ No newline at end of file diff --git a/functions/it_queueless_pushable.queuelessPushable.html b/functions/it_queueless_pushable.queuelessPushable.html new file mode 100644 index 00000000..a3bd5463 --- /dev/null +++ b/functions/it_queueless_pushable.queuelessPushable.html @@ -0,0 +1 @@ +queuelessPushable | Documentation
\ No newline at end of file diff --git a/functions/it_reduce.default.html b/functions/it_reduce.default.html new file mode 100644 index 00000000..cc6a1970 --- /dev/null +++ b/functions/it_reduce.default.html @@ -0,0 +1,2 @@ +default | Documentation
  • Reduces the values yielded by an (async) iterable

    +

    Type Parameters

    • T
    • V

    Parameters

    • source: Iterable<T>
    • func: ((acc, curr, index) => V)
        • (acc, curr, index): V
        • Parameters

          • acc: V
          • curr: T
          • index: number

          Returns V

    • init: V

    Returns V

  • Type Parameters

    • T
    • V

    Parameters

    • source: Iterable<T> | AsyncIterable<T>
    • func: ((acc, curr, index) => V)
        • (acc, curr, index): V
        • Parameters

          • acc: V
          • curr: T
          • index: number

          Returns V

    • init: V

    Returns Promise<V>

\ No newline at end of file diff --git a/functions/it_rpc.rpc-1.html b/functions/it_rpc.rpc-1.html new file mode 100644 index 00000000..66cfa2eb --- /dev/null +++ b/functions/it_rpc.rpc-1.html @@ -0,0 +1 @@ +rpc | Documentation
\ No newline at end of file diff --git a/functions/it_skip.default.html b/functions/it_skip.default.html new file mode 100644 index 00000000..0bca16a1 --- /dev/null +++ b/functions/it_skip.default.html @@ -0,0 +1,2 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/it_sort.default.html b/functions/it_sort.default.html new file mode 100644 index 00000000..057011b9 --- /dev/null +++ b/functions/it_sort.default.html @@ -0,0 +1,3 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/it_split.default.html b/functions/it_split.default.html new file mode 100644 index 00000000..0bb65e9a --- /dev/null +++ b/functions/it_split.default.html @@ -0,0 +1,2 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/it_take.default.html b/functions/it_take.default.html new file mode 100644 index 00000000..60449f04 --- /dev/null +++ b/functions/it_take.default.html @@ -0,0 +1,2 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/it_to_browser_readablestream.default.html b/functions/it_to_browser_readablestream.default.html new file mode 100644 index 00000000..55350df2 --- /dev/null +++ b/functions/it_to_browser_readablestream.default.html @@ -0,0 +1,2 @@ +default | Documentation
  • Converts an (async) iterator into a WHATWG ReadableStream

    +

    Type Parameters

    • T extends ArrayBufferView

    Parameters

    • source: AsyncIterable<T> | Iterable<T>
    • queuingStrategy: QueuingStrategy<T> = {}

    Returns ReadableStream<T>

\ No newline at end of file diff --git a/functions/it_to_buffer.default.html b/functions/it_to_buffer.default.html new file mode 100644 index 00000000..00139a25 --- /dev/null +++ b/functions/it_to_buffer.default.html @@ -0,0 +1,3 @@ +default | Documentation
\ No newline at end of file diff --git a/functions/pbStream.html b/functions/pbStream.html deleted file mode 100644 index 89dbb98d..00000000 --- a/functions/pbStream.html +++ /dev/null @@ -1 +0,0 @@ -pbStream | it-protobuf-stream
\ No newline at end of file diff --git a/hierarchy.html b/hierarchy.html new file mode 100644 index 00000000..da5c7627 --- /dev/null +++ b/hierarchy.html @@ -0,0 +1 @@ +Documentation

Documentation

Class Hierarchy

\ No newline at end of file diff --git a/index.html b/index.html index 47be0f6c..4fa8fc10 100644 --- a/index.html +++ b/index.html @@ -1,39 +1,50 @@ -it-protobuf-stream

it-protobuf-stream

it-protobuf-stream

codecov +Documentation

Documentation

it

codecov CI

-

Read and write protobuf messages over a duplex stream

+

A collection of utilities for making working with iterables more bearable

-

About

- -

This module makes it easy to send and receive length-prefixed Protobuf encoded -messages over streams.

-

Example

import { pbStream } from 'it-protobuf-stream'
import { MessageType } from './src/my-message-type.js'

// RequestType and ResponseType have been generate from `.proto` files and have
// `.encode` and `.decode` methods for serialization/deserialization

const stream = pbStream(duplex)

// write a message to the stream
stream.write({
foo: 'bar'
}, MessageType)

// read a message from the stream
const res = await stream.read(MessageType) -
-

Install

$ npm i it-protobuf-stream
-
-

Browser <script> tag

Loading this module through a script tag will make it's exports available as ItProtobufStream in the global namespace.

-
<script src="https://unpkg.com/it-protobuf-stream/dist/index.min.js"></script>
-
+

Packages

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/interfaces/Decoder.html b/interfaces/Decoder.html deleted file mode 100644 index 3a84ddde..00000000 --- a/interfaces/Decoder.html +++ /dev/null @@ -1,2 +0,0 @@ -Decoder | it-protobuf-stream

Interface Decoder<T>

A protobuf decoder - takes a byte array and returns an object

-
interface Decoder<T> ((data) => T)

Type Parameters

  • T
\ No newline at end of file diff --git a/interfaces/Encoder.html b/interfaces/Encoder.html deleted file mode 100644 index 99e05399..00000000 --- a/interfaces/Encoder.html +++ /dev/null @@ -1,2 +0,0 @@ -Encoder | it-protobuf-stream

Interface Encoder<T>

A protobuf encoder - takes an object and returns a byte array

-
interface Encoder<T> ((data) => Uint8Array)

Type Parameters

  • T
\ No newline at end of file diff --git a/interfaces/MessageStream.html b/interfaces/MessageStream.html deleted file mode 100644 index ec035c53..00000000 --- a/interfaces/MessageStream.html +++ /dev/null @@ -1,10 +0,0 @@ -MessageStream | it-protobuf-stream

Interface MessageStream<T, S>

A message reader/writer that only uses one type of message

-
interface MessageStream<T, S> {
    read(options?): Promise<T>;
    unwrap(): ProtobufStream<S>;
    write(d, options?): Promise<void>;
    writeV(d, options?): Promise<void>;
}

Type Parameters

  • T
  • S = unknown

Methods

Methods

\ No newline at end of file diff --git a/interfaces/ProtobufStream.html b/interfaces/ProtobufStream.html deleted file mode 100644 index 44ba66d1..00000000 --- a/interfaces/ProtobufStream.html +++ /dev/null @@ -1,12 +0,0 @@ -ProtobufStream | it-protobuf-stream

Interface ProtobufStream<Stream>

Convenience methods for working with protobuf streams

-
interface ProtobufStream<Stream> {
    pb<T>(proto): MessageStream<T, Stream>;
    read<T>(proto, options?): Promise<T>;
    unwrap(): Stream;
    write<T>(data, proto, options?): Promise<void>;
    writeV<T>(input, proto, options?): Promise<void>;
}

Type Parameters

  • Stream = unknown

Methods

Methods

\ No newline at end of file diff --git a/interfaces/ProtobufStreamOpts.html b/interfaces/ProtobufStreamOpts.html deleted file mode 100644 index 5c885075..00000000 --- a/interfaces/ProtobufStreamOpts.html +++ /dev/null @@ -1,10 +0,0 @@ -ProtobufStreamOpts | it-protobuf-stream

Interface ProtobufStreamOpts

interface ProtobufStreamOpts {
    maxDataLength: number;
    maxLengthLength: number;
    yieldBytes?: boolean;
    lengthDecoder(data): number;
    lengthEncoder(value): Uint8Array | Uint8ArrayList;
}

Hierarchy

Properties

maxDataLength: number
maxLengthLength: number
yieldBytes?: boolean

After the stream is unwrapped, any bytes that have been read from the -incoming stream will be yielded in-order as Uint8Array(s).

-

To yield a single Uint8ArrayList with all unread bytes instead, pass -false here.

-

Methods

  • Parameters

    Returns number

\ No newline at end of file diff --git a/interfaces/browser_readablestream_to_it.BrowserReadableStreamToItOptions.html b/interfaces/browser_readablestream_to_it.BrowserReadableStreamToItOptions.html new file mode 100644 index 00000000..2c2818c3 --- /dev/null +++ b/interfaces/browser_readablestream_to_it.BrowserReadableStreamToItOptions.html @@ -0,0 +1,2 @@ +BrowserReadableStreamToItOptions | Documentation
interface BrowserReadableStreamToItOptions {
    preventCancel?: boolean;
}

Properties

Properties

preventCancel?: boolean
\ No newline at end of file diff --git a/interfaces/it_batched_bytes.AsyncBatchedBytesOptions.html b/interfaces/it_batched_bytes.AsyncBatchedBytesOptions.html new file mode 100644 index 00000000..63380f3d --- /dev/null +++ b/interfaces/it_batched_bytes.AsyncBatchedBytesOptions.html @@ -0,0 +1,6 @@ +AsyncBatchedBytesOptions | Documentation
interface AsyncBatchedBytesOptions {
    size?: number;
    yieldAfter?: number;
}

Hierarchy (view full)

Properties

Properties

size?: number

The minimum number of bytes that should be in a batch (default: 1MB)

+
yieldAfter?: number

If this amount of time passes, yield all the bytes in the batch even +if they are below size (default: 0 - e.g. on every tick)

+
\ No newline at end of file diff --git a/interfaces/it_batched_bytes.AsyncBatchedObjectsOptions.html b/interfaces/it_batched_bytes.AsyncBatchedObjectsOptions.html new file mode 100644 index 00000000..2a810c45 --- /dev/null +++ b/interfaces/it_batched_bytes.AsyncBatchedObjectsOptions.html @@ -0,0 +1,9 @@ +AsyncBatchedObjectsOptions | Documentation

Interface AsyncBatchedObjectsOptions<T>

interface AsyncBatchedObjectsOptions<T> {
    size?: number;
    yieldAfter?: number;
    serialize(object, list): void;
}

Type Parameters

  • T

Hierarchy (view full)

Properties

Methods

Properties

size?: number

The minimum number of bytes that should be in a batch (default: 1MB)

+
yieldAfter?: number

If this amount of time passes, yield all the bytes in the batch even +if they are below size (default: 0 - e.g. on every tick)

+

Methods

\ No newline at end of file diff --git a/interfaces/it_batched_bytes.BatchedBytesOptions.html b/interfaces/it_batched_bytes.BatchedBytesOptions.html new file mode 100644 index 00000000..6dec2181 --- /dev/null +++ b/interfaces/it_batched_bytes.BatchedBytesOptions.html @@ -0,0 +1,3 @@ +BatchedBytesOptions | Documentation
interface BatchedBytesOptions {
    size?: number;
}

Hierarchy (view full)

Properties

Properties

size?: number

The minimum number of bytes that should be in a batch (default: 1MB)

+
\ No newline at end of file diff --git a/interfaces/it_batched_bytes.BatchedObjectsOptions.html b/interfaces/it_batched_bytes.BatchedObjectsOptions.html new file mode 100644 index 00000000..1f940156 --- /dev/null +++ b/interfaces/it_batched_bytes.BatchedObjectsOptions.html @@ -0,0 +1,6 @@ +BatchedObjectsOptions | Documentation

Interface BatchedObjectsOptions<T>

interface BatchedObjectsOptions<T> {
    size?: number;
    serialize(object, list): void;
}

Type Parameters

  • T

Hierarchy (view full)

Properties

Methods

Properties

size?: number

The minimum number of bytes that should be in a batch (default: 1MB)

+

Methods

  • This function should serialize the object and append the +result to the passed list

    +

    Parameters

    Returns void

\ No newline at end of file diff --git a/interfaces/it_buffer_stream.BufferStreamOptions.html b/interfaces/it_buffer_stream.BufferStreamOptions.html new file mode 100644 index 00000000..d80e8cf6 --- /dev/null +++ b/interfaces/it_buffer_stream.BufferStreamOptions.html @@ -0,0 +1,4 @@ +BufferStreamOptions | Documentation
interface BufferStreamOptions {
    chunkSize?: number;
    collector?(arr): void;
    generator?(length): Uint8Array | Promise<Uint8Array>;
}

Properties

Methods

Properties

chunkSize?: number

Methods

\ No newline at end of file diff --git a/interfaces/it_byte_stream.AbortOptions.html b/interfaces/it_byte_stream.AbortOptions.html new file mode 100644 index 00000000..99d8515d --- /dev/null +++ b/interfaces/it_byte_stream.AbortOptions.html @@ -0,0 +1,2 @@ +AbortOptions | Documentation
interface AbortOptions {
    signal?: AbortSignal;
}

Properties

Properties

signal?: AbortSignal
\ No newline at end of file diff --git a/interfaces/it_byte_stream.ByteStream.html b/interfaces/it_byte_stream.ByteStream.html new file mode 100644 index 00000000..fd62c869 --- /dev/null +++ b/interfaces/it_byte_stream.ByteStream.html @@ -0,0 +1,7 @@ +ByteStream | Documentation

Interface ByteStream<Stream>

interface ByteStream<Stream> {
    read(bytes?, options?): Promise<Uint8ArrayList>;
    unwrap(): Stream;
    write(input, options?): Promise<void>;
}

Type Parameters

  • Stream = unknown

Methods

Methods

\ No newline at end of file diff --git a/interfaces/it_byte_stream.ByteStreamOpts.html b/interfaces/it_byte_stream.ByteStreamOpts.html new file mode 100644 index 00000000..eadac9ab --- /dev/null +++ b/interfaces/it_byte_stream.ByteStreamOpts.html @@ -0,0 +1,6 @@ +ByteStreamOpts | Documentation
interface ByteStreamOpts {
    yieldBytes?: boolean;
}

Hierarchy

  • ByteStreamOpts

    Properties

    Properties

    yieldBytes?: boolean

    After the stream is unwrapped, any bytes that have been read from the +incoming stream will be yielded in-order as Uint8Array(s).

    +

    To yield a single Uint8ArrayList with all unread bytes instead, pass +false here.

    +
    \ No newline at end of file diff --git a/interfaces/it_length_prefixed_stream.AbortOptions.html b/interfaces/it_length_prefixed_stream.AbortOptions.html new file mode 100644 index 00000000..c83bb3df --- /dev/null +++ b/interfaces/it_length_prefixed_stream.AbortOptions.html @@ -0,0 +1,2 @@ +AbortOptions | Documentation
    interface AbortOptions {
        signal?: AbortSignal;
    }

    Properties

    Properties

    signal?: AbortSignal
    \ No newline at end of file diff --git a/interfaces/it_length_prefixed_stream.LengthPrefixedStream.html b/interfaces/it_length_prefixed_stream.LengthPrefixedStream.html new file mode 100644 index 00000000..5487e643 --- /dev/null +++ b/interfaces/it_length_prefixed_stream.LengthPrefixedStream.html @@ -0,0 +1,9 @@ +LengthPrefixedStream | Documentation
    interface LengthPrefixedStream<Stream> {
        read(options?): Promise<Uint8ArrayList>;
        unwrap(): Stream;
        write(input, options?): Promise<void>;
        writeV(input, options?): Promise<void>;
    }

    Type Parameters

    • Stream = unknown

    Methods

    Methods

    \ No newline at end of file diff --git a/interfaces/it_length_prefixed_stream.LengthPrefixedStreamOpts.html b/interfaces/it_length_prefixed_stream.LengthPrefixedStreamOpts.html new file mode 100644 index 00000000..767250b8 --- /dev/null +++ b/interfaces/it_length_prefixed_stream.LengthPrefixedStreamOpts.html @@ -0,0 +1,10 @@ +LengthPrefixedStreamOpts | Documentation
    interface LengthPrefixedStreamOpts {
        maxDataLength: number;
        maxLengthLength: number;
        yieldBytes?: boolean;
        lengthDecoder(data): number;
        lengthEncoder(value): Uint8ArrayList | Uint8Array;
    }

    Hierarchy (view full)

    Properties

    maxDataLength: number
    maxLengthLength: number
    yieldBytes?: boolean

    After the stream is unwrapped, any bytes that have been read from the +incoming stream will be yielded in-order as Uint8Array(s).

    +

    To yield a single Uint8ArrayList with all unread bytes instead, pass +false here.

    +

    Methods

    \ No newline at end of file diff --git a/interfaces/it_multipart.Part.html b/interfaces/it_multipart.Part.html new file mode 100644 index 00000000..9ec10ec2 --- /dev/null +++ b/interfaces/it_multipart.Part.html @@ -0,0 +1,3 @@ +Part | Documentation
    interface Part {
        body: AsyncIterable<Uint8Array>;
        headers: IncomingHttpHeaders;
    }

    Properties

    Properties

    body: AsyncIterable<Uint8Array>
    \ No newline at end of file diff --git a/interfaces/it_parallel.ParallelOptions.html b/interfaces/it_parallel.ParallelOptions.html new file mode 100644 index 00000000..b1e0ea0f --- /dev/null +++ b/interfaces/it_parallel.ParallelOptions.html @@ -0,0 +1,4 @@ +ParallelOptions | Documentation
    interface ParallelOptions {
        concurrency?: number;
        ordered?: boolean;
    }

    Properties

    Properties

    concurrency?: number

    How many jobs to execute in parallel (default: )

    +
    ordered?: boolean
    \ No newline at end of file diff --git a/interfaces/it_peekable.AsyncPeek.html b/interfaces/it_peekable.AsyncPeek.html new file mode 100644 index 00000000..68eaa322 --- /dev/null +++ b/interfaces/it_peekable.AsyncPeek.html @@ -0,0 +1,2 @@ +AsyncPeek | Documentation

    Interface AsyncPeek<T>

    interface AsyncPeek<T> {
        peek(): Promise<IteratorResult<T, undefined>>;
    }

    Type Parameters

    • T

    Methods

    Methods

    \ No newline at end of file diff --git a/interfaces/it_peekable.Peek.html b/interfaces/it_peekable.Peek.html new file mode 100644 index 00000000..6a3fa337 --- /dev/null +++ b/interfaces/it_peekable.Peek.html @@ -0,0 +1,2 @@ +Peek | Documentation
    interface Peek<T> {
        peek(): IteratorResult<T, undefined>;
    }

    Type Parameters

    • T

    Methods

    Methods

    • Returns IteratorResult<T, undefined>

    \ No newline at end of file diff --git a/interfaces/it_peekable.Push.html b/interfaces/it_peekable.Push.html new file mode 100644 index 00000000..3af604d8 --- /dev/null +++ b/interfaces/it_peekable.Push.html @@ -0,0 +1,2 @@ +Push | Documentation
    interface Push<T> {
        push(value): void;
    }

    Type Parameters

    • T

    Methods

    Methods

    • Parameters

      • value: T

      Returns void

    \ No newline at end of file diff --git a/interfaces/AbortOptions.html b/interfaces/it_protobuf_stream.AbortOptions.html similarity index 50% rename from interfaces/AbortOptions.html rename to interfaces/it_protobuf_stream.AbortOptions.html index 817c4294..1c7f09f2 100644 --- a/interfaces/AbortOptions.html +++ b/interfaces/it_protobuf_stream.AbortOptions.html @@ -1,2 +1,2 @@ -AbortOptions | it-protobuf-stream

    Interface AbortOptions

    interface AbortOptions {
        signal?: AbortSignal;
    }

    Properties

    Properties

    signal?: AbortSignal
    \ No newline at end of file +AbortOptions | Documentation
    interface AbortOptions {
        signal?: AbortSignal;
    }

    Properties

    Properties

    signal?: AbortSignal
    \ No newline at end of file diff --git a/interfaces/it_protobuf_stream.Decoder.html b/interfaces/it_protobuf_stream.Decoder.html new file mode 100644 index 00000000..9852c6ce --- /dev/null +++ b/interfaces/it_protobuf_stream.Decoder.html @@ -0,0 +1,2 @@ +Decoder | Documentation

    A protobuf decoder - takes a byte array and returns an object

    +
    interface Decoder<T> ((data) => T)

    Type Parameters

    • T
    \ No newline at end of file diff --git a/interfaces/it_protobuf_stream.Encoder.html b/interfaces/it_protobuf_stream.Encoder.html new file mode 100644 index 00000000..b98bdd8e --- /dev/null +++ b/interfaces/it_protobuf_stream.Encoder.html @@ -0,0 +1,2 @@ +Encoder | Documentation

    A protobuf encoder - takes an object and returns a byte array

    +
    interface Encoder<T> ((data) => Uint8Array)

    Type Parameters

    • T
    \ No newline at end of file diff --git a/interfaces/it_protobuf_stream.MessageStream.html b/interfaces/it_protobuf_stream.MessageStream.html new file mode 100644 index 00000000..166fa213 --- /dev/null +++ b/interfaces/it_protobuf_stream.MessageStream.html @@ -0,0 +1,10 @@ +MessageStream | Documentation

    A message reader/writer that only uses one type of message

    +
    interface MessageStream<T, S> {
        read(options?): Promise<T>;
        unwrap(): ProtobufStream<S>;
        write(d, options?): Promise<void>;
        writeV(d, options?): Promise<void>;
    }

    Type Parameters

    • T
    • S = unknown

    Methods

    Methods

    \ No newline at end of file diff --git a/interfaces/it_protobuf_stream.ProtobufStream.html b/interfaces/it_protobuf_stream.ProtobufStream.html new file mode 100644 index 00000000..65d01b30 --- /dev/null +++ b/interfaces/it_protobuf_stream.ProtobufStream.html @@ -0,0 +1,12 @@ +ProtobufStream | Documentation

    Interface ProtobufStream<Stream>

    Convenience methods for working with protobuf streams

    +
    interface ProtobufStream<Stream> {
        pb<T>(proto): MessageStream<T, Stream>;
        read<T>(proto, options?): Promise<T>;
        unwrap(): Stream;
        write<T>(data, proto, options?): Promise<void>;
        writeV<T>(input, proto, options?): Promise<void>;
    }

    Type Parameters

    • Stream = unknown

    Methods

    Methods

    \ No newline at end of file diff --git a/interfaces/it_protobuf_stream.ProtobufStreamOpts.html b/interfaces/it_protobuf_stream.ProtobufStreamOpts.html new file mode 100644 index 00000000..925d44a4 --- /dev/null +++ b/interfaces/it_protobuf_stream.ProtobufStreamOpts.html @@ -0,0 +1,10 @@ +ProtobufStreamOpts | Documentation
    interface ProtobufStreamOpts {
        maxDataLength: number;
        maxLengthLength: number;
        yieldBytes?: boolean;
        lengthDecoder(data): number;
        lengthEncoder(value): Uint8Array | Uint8ArrayList;
    }

    Hierarchy (view full)

    Properties

    maxDataLength: number
    maxLengthLength: number
    yieldBytes?: boolean

    After the stream is unwrapped, any bytes that have been read from the +incoming stream will be yielded in-order as Uint8Array(s).

    +

    To yield a single Uint8ArrayList with all unread bytes instead, pass +false here.

    +

    Methods

    \ No newline at end of file diff --git a/interfaces/it_queueless_pushable.AbortOptions.html b/interfaces/it_queueless_pushable.AbortOptions.html new file mode 100644 index 00000000..4e7595d0 --- /dev/null +++ b/interfaces/it_queueless_pushable.AbortOptions.html @@ -0,0 +1,2 @@ +AbortOptions | Documentation
    interface AbortOptions {
        signal?: AbortSignal;
    }

    Properties

    Properties

    signal?: AbortSignal
    \ No newline at end of file diff --git a/interfaces/it_queueless_pushable.Pushable.html b/interfaces/it_queueless_pushable.Pushable.html new file mode 100644 index 00000000..1932d670 --- /dev/null +++ b/interfaces/it_queueless_pushable.Pushable.html @@ -0,0 +1,12 @@ +Pushable | Documentation
    interface Pushable<T> {
        [asyncIterator](): AsyncGenerator<T, void, unknown>;
        end(err?, options?): Promise<void>;
        next(...args): Promise<IteratorResult<T, void>>;
        push(value, options?): Promise<void>;
        return(value): Promise<IteratorResult<T, void>>;
        throw(e): Promise<IteratorResult<T, void>>;
    }

    Type Parameters

    • T

    Hierarchy

    Methods

    • Returns AsyncGenerator<T, void, unknown>

    • Parameters

      • Rest ...args: [] | [unknown]

      Returns Promise<IteratorResult<T, void>>

    • Parameters

      • value: void | PromiseLike<void>

      Returns Promise<IteratorResult<T, void>>

    • Parameters

      • e: any

      Returns Promise<IteratorResult<T, void>>

    \ No newline at end of file diff --git a/interfaces/it_rpc.CallbackFunction.html b/interfaces/it_rpc.CallbackFunction.html new file mode 100644 index 00000000..df73fd9f --- /dev/null +++ b/interfaces/it_rpc.CallbackFunction.html @@ -0,0 +1,3 @@ +CallbackFunction | Documentation

    Interface CallbackFunction

    interface CallbackFunction {
        context: any;
        fn(...args): any;
    }

    Properties

    Methods

    fn +

    Properties

    context: any

    Methods

    \ No newline at end of file diff --git a/interfaces/it_rpc.Invocation.html b/interfaces/it_rpc.Invocation.html new file mode 100644 index 00000000..6cb59ddf --- /dev/null +++ b/interfaces/it_rpc.Invocation.html @@ -0,0 +1,17 @@ +Invocation | Documentation

    Interface Invocation

    interface Invocation {
        abortControllers: AbortController[];
        abortSignals: AbortSignal[];
        callbacks: Map<string, CallbackFunction>;
        children: Map<string, Invocation>;
        parents: string[];
        result: DeferredPromise<any>;
        scope: string;
    }

    Properties

    abortControllers: AbortController[]

    Used on the server side to hold abort controllers that will be aborted +if the client sends an abort message

    +
    abortSignals: AbortSignal[]

    Used on the client side to store abort signals that will cause an abort +message to be sent

    +
    callbacks: Map<string, CallbackFunction>

    Holds references to any callback functions passed as arguments

    +
    children: Map<string, Invocation>

    Any ongoing invocations of callbacks during the main method execution

    +
    parents: string[]

    Scopes of parent invocations

    +
    result: DeferredPromise<any>

    The result of the execution

    +
    scope: string

    The scope of this invocation

    +
    \ No newline at end of file diff --git a/interfaces/it_rpc.RPC.html b/interfaces/it_rpc.RPC.html new file mode 100644 index 00000000..6818143c --- /dev/null +++ b/interfaces/it_rpc.RPC.html @@ -0,0 +1,5 @@ +RPC | Documentation
    interface RPC {
        sink: Sink<AsyncGenerator<Uint8Array, void, unknown>, unknown>;
        source: AsyncGenerator<Uint8Array, void, unknown>;
        createClient<T>(name): T;
        createTarget(name, target): void;
    }

    Hierarchy

    Properties

    Methods

    Properties

    sink: Sink<AsyncGenerator<Uint8Array, void, unknown>, unknown>
    source: AsyncGenerator<Uint8Array, void, unknown>

    Methods

    \ No newline at end of file diff --git a/interfaces/it_rpc.RPCIinit.html b/interfaces/it_rpc.RPCIinit.html new file mode 100644 index 00000000..56258326 --- /dev/null +++ b/interfaces/it_rpc.RPCIinit.html @@ -0,0 +1,2 @@ +RPCIinit | Documentation

    Interface RPCIinit

    interface RPCIinit {
        valueCodecs?: ValueCodec<any>[];
    }

    Properties

    Properties

    valueCodecs?: ValueCodec<any>[]
    \ No newline at end of file diff --git a/interfaces/it_rpc.ValueCodec.html b/interfaces/it_rpc.ValueCodec.html new file mode 100644 index 00000000..01b2bc8c --- /dev/null +++ b/interfaces/it_rpc.ValueCodec.html @@ -0,0 +1,16 @@ +ValueCodec | Documentation

    Interface ValueCodec<T>

    it-rpc uses a binary representation of values on the wire. By default it +uses CBOR though it is not a requirement.

    +

    Custom ValueCodecs can be used to extend the supported value types +with application-specific types.

    +
    interface ValueCodec<T> {
        type: number;
        canEncode(val): boolean;
        decode(buf, codec, pushable, invocation): T;
        encode?(val, codec, context?, invocation?): Uint8Array;
    }

    Type Parameters

    • T = any

    Properties

    Methods

    Properties

    type: number

    A unique number for the value type. It's recommended that user defined +types use numbers greater than 1000 to avoid conflicting with built in +value transformers

    +

    Methods

    \ No newline at end of file diff --git a/interfaces/it_rpc.ValueCodecs.html b/interfaces/it_rpc.ValueCodecs.html new file mode 100644 index 00000000..f6cf603b --- /dev/null +++ b/interfaces/it_rpc.ValueCodecs.html @@ -0,0 +1,3 @@ +ValueCodecs | Documentation

    Interface ValueCodecs

    interface ValueCodecs {
        fromValue(val, pushable, invocation): any;
        toValue(val, context?, invocation?): Value;
    }

    Methods

    Methods

    \ No newline at end of file diff --git a/interfaces/it_sort.CompareFunction.html b/interfaces/it_sort.CompareFunction.html new file mode 100644 index 00000000..b0b655cd --- /dev/null +++ b/interfaces/it_sort.CompareFunction.html @@ -0,0 +1 @@ +CompareFunction | Documentation

    Interface CompareFunction<T>

    interface CompareFunction<T> ((a, b) => number)

    Type Parameters

    • T
    • Parameters

      Returns number

    \ No newline at end of file diff --git a/interfaces/it_split.SplitOptions.html b/interfaces/it_split.SplitOptions.html new file mode 100644 index 00000000..656113ea --- /dev/null +++ b/interfaces/it_split.SplitOptions.html @@ -0,0 +1,2 @@ +SplitOptions | Documentation

    Interface SplitOptions

    interface SplitOptions {
        delimiter?: Uint8Array;
    }

    Properties

    Properties

    delimiter?: Uint8Array
    \ No newline at end of file diff --git a/modules.html b/modules.html deleted file mode 100644 index e309bdbf..00000000 --- a/modules.html +++ /dev/null @@ -1,12 +0,0 @@ -it-protobuf-stream

    it-protobuf-stream

    This module makes it easy to send and receive length-prefixed Protobuf encoded -messages over streams.

    -

    Example

    import { pbStream } from 'it-protobuf-stream'
    import { MessageType } from './src/my-message-type.js'

    // RequestType and ResponseType have been generate from `.proto` files and have
    // `.encode` and `.decode` methods for serialization/deserialization

    const stream = pbStream(duplex)

    // write a message to the stream
    stream.write({
    foo: 'bar'
    }, MessageType)

    // read a message from the stream
    const res = await stream.read(MessageType) -
    -

    Index

    Interfaces

    Functions

    \ No newline at end of file diff --git a/modules/blob_to_it.html b/modules/blob_to_it.html new file mode 100644 index 00000000..1ea23417 --- /dev/null +++ b/modules/blob_to_it.html @@ -0,0 +1,42 @@ +blob-to-it | Documentation

    Module blob-to-it

    Allows reading Blob contents as an async iterator.

    +

    Example

    import toIt from 'blob-to-it'
    import all from 'it-all'

    const content = [ Uint8Array.from([0, 1, 2, 3, 4]) ]
    const blob = new Blob(content)
    const arr = await all(toIt(blob))

    console.info(arr) // [ [ 0, 1, 2, 3, 4 ] ] +
    +

    blob-to-it

    codecov +CI

    +
    +

    Turns a blob into an async iterator

    +
    +

    About

    + +

    Allows reading Blob contents as an async iterator.

    +

    Example

    import toIt from 'blob-to-it'
    import all from 'it-all'

    const content = [ Uint8Array.from([0, 1, 2, 3, 4]) ]
    const blob = new Blob(content)
    const arr = await all(toIt(blob))

    console.info(arr) // [ [ 0, 1, 2, 3, 4 ] ] +
    +

    Install

    $ npm i blob-to-it
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as BlobToIt in the global namespace.

    +
    <script src="https://unpkg.com/blob-to-it/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/browser_readablestream_to_it.html b/modules/browser_readablestream_to_it.html new file mode 100644 index 00000000..575cfea4 --- /dev/null +++ b/modules/browser_readablestream_to_it.html @@ -0,0 +1,53 @@ +browser-readablestream-to-it | Documentation

    Module browser-readablestream-to-it

    Allows treating a browser readable stream as an async iterator.

    +

    Example

    import toIt from 'browser-readablestream-to-it'
    import all from 'it-all'

    const content = [0, 1, 2, 3, 4]

    const stream = new ReadableStream({
    start(controller) {
    for (let i = 0; i < content.length; i++) {
    controller.enqueue(content[i])
    }

    controller.close()
    }
    })

    const arr = await all(toIt(stream))

    console.info(arr) // 0, 1, 2, 3, 4 +
    +

    preventCancel

    By default a readable stream will have .cancel called on it once it has ended or +reading has stopped prematurely.

    +

    To prevent this behaviour, pass preventCancel: true as an option:

    +
    const arr = await all(toIt(stream, { preventCancel: true }))

    console.info(arr) // 0, 1, 2, 3, 4 +
    +

    browser-readablestream-to-it

    codecov +CI

    +
    +

    Turns a browser readble stream into an async iterator

    +
    +

    About

    + +

    Allows treating a browser readable stream as an async iterator.

    +

    Example

    import toIt from 'browser-readablestream-to-it'
    import all from 'it-all'

    const content = [0, 1, 2, 3, 4]

    const stream = new ReadableStream({
    start(controller) {
    for (let i = 0; i < content.length; i++) {
    controller.enqueue(content[i])
    }

    controller.close()
    }
    })

    const arr = await all(toIt(stream))

    console.info(arr) // 0, 1, 2, 3, 4 +
    +

    preventCancel

    By default a readable stream will have .cancel called on it once it has ended or +reading has stopped prematurely.

    +

    To prevent this behaviour, pass preventCancel: true as an option:

    +
    const arr = await all(toIt(stream, { preventCancel: true }))

    console.info(arr) // 0, 1, 2, 3, 4 +
    +

    Install

    $ npm i browser-readablestream-to-it
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as BrowserReadablestreamToIt in the global namespace.

    +
    <script src="https://unpkg.com/browser-readablestream-to-it/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Interfaces

    Functions

    \ No newline at end of file diff --git a/modules/it_all.html b/modules/it_all.html new file mode 100644 index 00000000..644ed65a --- /dev/null +++ b/modules/it_all.html @@ -0,0 +1,48 @@ +it-all | Documentation

    Module it-all

    For when you need a one-liner to collect iterable values.

    +

    Example

    import all from 'it-all'

    // This can also be an iterator, etc
    const values = function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const arr = all(values)

    console.info(arr) // 0, 1, 2, 3, 4 +
    +

    Async sources must be awaited:

    +
    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const arr = await all(values())

    console.info(arr) // 0, 1, 2, 3, 4 +
    +

    it-all

    codecov +CI

    +
    +

    Collects all values from an (async) iterable and returns them as an array

    +
    +

    About

    + +

    For when you need a one-liner to collect iterable values.

    +

    Example

    import all from 'it-all'

    // This can also be an iterator, etc
    const values = function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const arr = all(values)

    console.info(arr) // 0, 1, 2, 3, 4 +
    +

    Async sources must be awaited:

    +
    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const arr = await all(values())

    console.info(arr) // 0, 1, 2, 3, 4 +
    +

    Install

    $ npm i it-all
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItAll in the global namespace.

    +
    <script src="https://unpkg.com/it-all/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_batch.html b/modules/it_batch.html new file mode 100644 index 00000000..860a473a --- /dev/null +++ b/modules/it_batch.html @@ -0,0 +1,48 @@ +it-batch | Documentation

    Module it-batch

    The final batch may be smaller than the max.

    +

    Example

    import batch from 'it-batch'
    import all from 'it-all'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]
    const batchSize = 2

    const result = all(batch(values, batchSize))

    console.info(result) // [0, 1], [2, 3], [4] +
    +

    Async sources must be awaited:

    +
    import batch from 'it-batch'
    import all from 'it-all'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const batchSize = 2
    const result = await all(batch(values(), batchSize))

    console.info(result) // [0, 1], [2, 3], [4] +
    +

    it-batch

    codecov +CI

    +
    +

    Takes an async iterator that emits things and emits them as fixed size batches

    +
    +

    About

    + +

    The final batch may be smaller than the max.

    +

    Example

    import batch from 'it-batch'
    import all from 'it-all'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]
    const batchSize = 2

    const result = all(batch(values, batchSize))

    console.info(result) // [0, 1], [2, 3], [4] +
    +

    Async sources must be awaited:

    +
    import batch from 'it-batch'
    import all from 'it-all'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const batchSize = 2
    const result = await all(batch(values(), batchSize))

    console.info(result) // [0, 1], [2, 3], [4] +
    +

    Install

    $ npm i it-batch
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItBatch in the global namespace.

    +
    <script src="https://unpkg.com/it-batch/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_batched_bytes.html b/modules/it_batched_bytes.html new file mode 100644 index 00000000..ffd5a693 --- /dev/null +++ b/modules/it_batched_bytes.html @@ -0,0 +1,52 @@ +it-batched-bytes | Documentation

    Module it-batched-bytes

    The final batch may be smaller than the max.

    +

    Example

    import batch from 'it-batched-bytes'
    import all from 'it-all'

    // This can also be an iterator, generator, etc
    const values = [
    Uint8Array.from([0]),
    Uint8Array.from([1]),
    Uint8Array.from([2]),
    Uint8Array.from([3]),
    Uint8Array.from([4])
    ]
    const batchSize = 2

    const result = all(batch(values, { size: batchSize }))

    console.info(result) // [0, 1], [2, 3], [4] +
    +

    Async sources must be awaited:

    +
    import batch from 'it-batched-bytes'
    import all from 'it-all'

    const values = async function * () {
    yield Uint8Array.from([0])
    yield Uint8Array.from([1])
    yield Uint8Array.from([2])
    yield Uint8Array.from([3])
    yield Uint8Array.from([4])
    }
    const batchSize = 2

    const result = await all(batch(values, { size: batchSize }))

    console.info(result) // [0, 1], [2, 3], [4] +
    +

    it-batched-bytes

    codecov +CI

    +
    +

    Takes an async iterator that emits byte arrays and emits them as fixed size batches

    +
    +

    About

    + +

    The final batch may be smaller than the max.

    +

    Example

    import batch from 'it-batched-bytes'
    import all from 'it-all'

    // This can also be an iterator, generator, etc
    const values = [
    Uint8Array.from([0]),
    Uint8Array.from([1]),
    Uint8Array.from([2]),
    Uint8Array.from([3]),
    Uint8Array.from([4])
    ]
    const batchSize = 2

    const result = all(batch(values, { size: batchSize }))

    console.info(result) // [0, 1], [2, 3], [4] +
    +

    Async sources must be awaited:

    +
    import batch from 'it-batched-bytes'
    import all from 'it-all'

    const values = async function * () {
    yield Uint8Array.from([0])
    yield Uint8Array.from([1])
    yield Uint8Array.from([2])
    yield Uint8Array.from([3])
    yield Uint8Array.from([4])
    }
    const batchSize = 2

    const result = await all(batch(values, { size: batchSize }))

    console.info(result) // [0, 1], [2, 3], [4] +
    +

    Install

    $ npm i it-batched-bytes
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItBatchedBytes in the global namespace.

    +
    <script src="https://unpkg.com/it-batched-bytes/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Interfaces

    Functions

    \ No newline at end of file diff --git a/modules/it_buffer_stream.html b/modules/it_buffer_stream.html new file mode 100644 index 00000000..fa03cde2 --- /dev/null +++ b/modules/it_buffer_stream.html @@ -0,0 +1,43 @@ +it-buffer-stream | Documentation

    Module it-buffer-stream

    Generate a stream of buffers, useful for testing purposes.

    +

    Example

    import bufferStream from 'it-buffer-stream'

    const totalLength = //... a big number

    // all options are optional, defaults are shown
    const options = {
    chunkSize: 4096, // how many bytes will be in each buffer
    collector: (buffer) => {
    // will be called as each buffer is generated. the final buffer
    // may be smaller than `chunkSize`
    },
    generator: async (size) => {
    // return a promise that resolves to a buffer of length `size`
    //
    // if omitted, `Promise.resolve(crypto.randomBytes(size))` will be used
    }
    }

    let buffers = []

    for await (buf of bufferStream(totalLength, options)) {
    buffers.push(buf)
    }

    // `buffers` is an array of Buffers the combined length of which === totalLength +
    +

    it-buffer-stream

    codecov +CI

    +
    +

    An async iterator that emits buffers containing bytes up to a certain length

    +
    +

    About

    + +

    Generate a stream of buffers, useful for testing purposes.

    +

    Example

    import bufferStream from 'it-buffer-stream'

    const totalLength = //... a big number

    // all options are optional, defaults are shown
    const options = {
    chunkSize: 4096, // how many bytes will be in each buffer
    collector: (buffer) => {
    // will be called as each buffer is generated. the final buffer
    // may be smaller than `chunkSize`
    },
    generator: async (size) => {
    // return a promise that resolves to a buffer of length `size`
    //
    // if omitted, `Promise.resolve(crypto.randomBytes(size))` will be used
    }
    }

    let buffers = []

    for await (buf of bufferStream(totalLength, options)) {
    buffers.push(buf)
    }

    // `buffers` is an array of Buffers the combined length of which === totalLength +
    +

    Install

    $ npm i it-buffer-stream
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItBufferStream in the global namespace.

    +
    <script src="https://unpkg.com/it-buffer-stream/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Interfaces

    Functions

    \ No newline at end of file diff --git a/modules/it_byte_stream.html b/modules/it_byte_stream.html new file mode 100644 index 00000000..40dda451 --- /dev/null +++ b/modules/it_byte_stream.html @@ -0,0 +1,47 @@ +it-byte-stream | Documentation

    Module it-byte-stream

    This module makes it easy to send and receive bytes over streams.

    +

    Example

    import { byteStream } from 'it-byte-stream'

    const stream = byteStream(duplex)

    // read the next chunk
    const bytes = await stream.read()

    // read the next five bytes
    const fiveBytes = await stream.read(5)

    // write bytes into the stream
    await stream.write(Uint8Array.from([0, 1, 2, 3, 4])) +
    +

    it-byte-stream

    codecov +CI

    +
    +

    Read and write arbitrary bytes over a duplex stream

    +
    +

    About

    + +

    This module makes it easy to send and receive bytes over streams.

    +

    Example

    import { byteStream } from 'it-byte-stream'

    const stream = byteStream(duplex)

    // read the next chunk
    const bytes = await stream.read()

    // read the next five bytes
    const fiveBytes = await stream.read(5)

    // write bytes into the stream
    await stream.write(Uint8Array.from([0, 1, 2, 3, 4])) +
    +

    Install

    $ npm i it-byte-stream
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItByteStream in the global namespace.

    +
    <script src="https://unpkg.com/it-byte-stream/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Classes

    Interfaces

    Functions

    \ No newline at end of file diff --git a/modules/it_drain.html b/modules/it_drain.html new file mode 100644 index 00000000..14acf26c --- /dev/null +++ b/modules/it_drain.html @@ -0,0 +1,48 @@ +it-drain | Documentation

    Module it-drain

    Mostly useful for tests or when you want to be explicit about consuming an iterable without doing anything with any yielded values.

    +

    Example

    import drain from 'it-drain'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    drain(values) +
    +

    Async sources must be awaited:

    +
    import drain from 'it-drain'

    const values = async function * {
    yield * [0, 1, 2, 3, 4]
    }

    await drain(values()) +
    +

    it-drain

    codecov +CI

    +
    +

    Empties an async iterator

    +
    +

    About

    + +

    Mostly useful for tests or when you want to be explicit about consuming an iterable without doing anything with any yielded values.

    +

    Example

    import drain from 'it-drain'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    drain(values) +
    +

    Async sources must be awaited:

    +
    import drain from 'it-drain'

    const values = async function * {
    yield * [0, 1, 2, 3, 4]
    }

    await drain(values()) +
    +

    Install

    $ npm i it-drain
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItDrain in the global namespace.

    +
    <script src="https://unpkg.com/it-drain/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_filter.html b/modules/it_filter.html new file mode 100644 index 00000000..98d9aba6 --- /dev/null +++ b/modules/it_filter.html @@ -0,0 +1,48 @@ +it-filter | Documentation

    Module it-filter

    Filter values out of an (async)iterable

    +

    Example

    import all from 'it-all'
    import filter from 'it-filter'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const fn = (val, index) => val > 2 // Return boolean to keep item

    const arr = all(filter(values, fn))

    console.info(arr) // 3, 4 +
    +

    Async sources and filter functions must be awaited:

    +
    import all from 'it-all'
    import filter from 'it-filter'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const fn = async val => (val, index) > 2 // Return boolean or promise of boolean to keep item

    const arr = await all(filter(values, fn))

    console.info(arr) // 3, 4 +
    +

    it-filter

    codecov +CI

    +
    +

    Filters the passed iterable by using the filter function

    +
    +

    About

    + +

    Filter values out of an (async)iterable

    +

    Example

    import all from 'it-all'
    import filter from 'it-filter'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const fn = (val, index) => val > 2 // Return boolean to keep item

    const arr = all(filter(values, fn))

    console.info(arr) // 3, 4 +
    +

    Async sources and filter functions must be awaited:

    +
    import all from 'it-all'
    import filter from 'it-filter'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const fn = async val => (val, index) > 2 // Return boolean or promise of boolean to keep item

    const arr = await all(filter(values, fn))

    console.info(arr) // 3, 4 +
    +

    Install

    $ npm i it-filter
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItFilter in the global namespace.

    +
    <script src="https://unpkg.com/it-filter/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_first.html b/modules/it_first.html new file mode 100644 index 00000000..181788e0 --- /dev/null +++ b/modules/it_first.html @@ -0,0 +1,48 @@ +it-first | Documentation

    Module it-first

    Return the first value in an (async)iterable

    +

    Example

    import first from 'it-first'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const res = first(values)

    console.info(res) // 0 +
    +

    Async sources must be awaited:

    +
    import first from 'it-first'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const res = await first(values())

    console.info(res) // 0 +
    +

    it-first

    codecov +CI

    +
    +

    Returns the first result from an async iterator

    +
    +

    About

    + +

    Return the first value in an (async)iterable

    +

    Example

    import first from 'it-first'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const res = first(values)

    console.info(res) // 0 +
    +

    Async sources must be awaited:

    +
    import first from 'it-first'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const res = await first(values())

    console.info(res) // 0 +
    +

    Install

    $ npm i it-first
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItFirst in the global namespace.

    +
    <script src="https://unpkg.com/it-first/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_flat_batch.html b/modules/it_flat_batch.html new file mode 100644 index 00000000..96356b47 --- /dev/null +++ b/modules/it_flat_batch.html @@ -0,0 +1,48 @@ +it-flat-batch | Documentation

    Module it-flat-batch

    The final batch may be smaller than requested batch size.

    +

    Example

    import batch from 'it-flat-batch'
    import all from 'it-all'

    // This can also be an iterator, async iterator, generator, etc
    const values = [[0, 1, 2], [3], [4]]
    const batchSize = 2

    const result = all(batch(values, batchSize))

    console.info(result) // [0, 1], [2, 3], [4] +
    +

    Async sources must be awaited:

    +
    import batch from 'it-flat-batch'
    import all from 'it-all'

    const values = async function * () {
    yield * [[0, 1, 2], [3], [4]]
    }
    const batchSize = 2

    const result = await all(batch(values(), batchSize))

    console.info(result) // [0, 1], [2, 3], [4] +
    +

    it-flat-batch

    codecov +CI

    +
    +

    Takes an async iterator that emits variable length arrays and emits them as fixed size batches

    +
    +

    About

    + +

    The final batch may be smaller than requested batch size.

    +

    Example

    import batch from 'it-flat-batch'
    import all from 'it-all'

    // This can also be an iterator, async iterator, generator, etc
    const values = [[0, 1, 2], [3], [4]]
    const batchSize = 2

    const result = all(batch(values, batchSize))

    console.info(result) // [0, 1], [2, 3], [4] +
    +

    Async sources must be awaited:

    +
    import batch from 'it-flat-batch'
    import all from 'it-all'

    const values = async function * () {
    yield * [[0, 1, 2], [3], [4]]
    }
    const batchSize = 2

    const result = await all(batch(values(), batchSize))

    console.info(result) // [0, 1], [2, 3], [4] +
    +

    Install

    $ npm i it-flat-batch
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItFlatBatch in the global namespace.

    +
    <script src="https://unpkg.com/it-flat-batch/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_foreach.html b/modules/it_foreach.html new file mode 100644 index 00000000..beb458ae --- /dev/null +++ b/modules/it_foreach.html @@ -0,0 +1,52 @@ +it-foreach | Documentation

    Module it-foreach

    Calls a function for each value in an (async)iterable.

    +

    The function can be sync or async.

    +

    Async functions can be awaited on so may slow down processing of the (async)iterable.

    +

    Example

    import each from 'it-foreach'
    import drain from 'it-drain'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    // prints [0, 0], [1, 1], [2, 2], [3, 3], [4, 4]
    const arr = drain(
    each(values, console.info)
    ) +
    +

    Async sources and callbacks must be awaited:

    +
    import each from 'it-foreach'
    import drain from 'it-drain'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    // prints [0, 0], [1, 1], [2, 2], [3, 3], [4, 4]
    const arr = await drain(
    each(values(), console.info)
    ) +
    +

    it-foreach

    codecov +CI

    +
    +

    Invokes the passed function for each item in an iterable

    +
    +

    About

    + +

    Calls a function for each value in an (async)iterable.

    +

    The function can be sync or async.

    +

    Async functions can be awaited on so may slow down processing of the (async)iterable.

    +

    Example

    import each from 'it-foreach'
    import drain from 'it-drain'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    // prints [0, 0], [1, 1], [2, 2], [3, 3], [4, 4]
    const arr = drain(
    each(values, console.info)
    ) +
    +

    Async sources and callbacks must be awaited:

    +
    import each from 'it-foreach'
    import drain from 'it-drain'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    // prints [0, 0], [1, 1], [2, 2], [3, 3], [4, 4]
    const arr = await drain(
    each(values(), console.info)
    ) +
    +

    Install

    $ npm i it-foreach
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItForeach in the global namespace.

    +
    <script src="https://unpkg.com/it-foreach/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_glob.html b/modules/it_glob.html new file mode 100644 index 00000000..5ab47887 --- /dev/null +++ b/modules/it_glob.html @@ -0,0 +1,44 @@ +it-glob | Documentation

    Module it-glob

    Like glob but async iterable.

    +

    File separators on Windows will be yielded as / and not ``.

    +

    Example

    import glob from 'it-glob'

    // All options are passed through to fast-glob
    const options = {}

    for await (const path of glob('/path/to/file', '**/*', options)) {
    console.info(path)
    } +
    +

    See the fast-glob docs for the full list of options.

    +

    it-glob

    codecov +CI

    +
    +

    Async iterable filename pattern matcher

    +
    +

    About

    + +

    Like glob but async iterable.

    +

    File separators on Windows will be yielded as / and not ``.

    +

    Example

    import glob from 'it-glob'

    // All options are passed through to fast-glob
    const options = {}

    for await (const path of glob('/path/to/file', '**/*', options)) {
    console.info(path)
    } +
    +

    See the fast-glob docs for the full list of options.

    +

    Install

    $ npm i it-glob
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Type Aliases

    Functions

    \ No newline at end of file diff --git a/modules/it_last.html b/modules/it_last.html new file mode 100644 index 00000000..f46bff24 --- /dev/null +++ b/modules/it_last.html @@ -0,0 +1,48 @@ +it-last | Documentation

    Module it-last

    Return the last value from an (async)iterable.

    +

    Example

    import last from 'it-last'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const res = last(values)

    console.info(res) // 4 +
    +

    Async sources must be awaited:

    +
    import last from 'it-last'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const res = await last(values())

    console.info(res) // 4 +
    +

    it-last

    codecov +CI

    +
    +

    Returns the last result from an async iterator

    +
    +

    About

    + +

    Return the last value from an (async)iterable.

    +

    Example

    import last from 'it-last'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const res = last(values)

    console.info(res) // 4 +
    +

    Async sources must be awaited:

    +
    import last from 'it-last'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const res = await last(values())

    console.info(res) // 4 +
    +

    Install

    $ npm i it-last
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItLast in the global namespace.

    +
    <script src="https://unpkg.com/it-last/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_length.html b/modules/it_length.html new file mode 100644 index 00000000..2efdc76d --- /dev/null +++ b/modules/it_length.html @@ -0,0 +1,50 @@ +it-length | Documentation

    Module it-length

    Counts the number of items in an (async)iterable.

    +

    N.b. will consume the iterable

    +

    Example

    import length from 'it-length'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const res = length(values)

    console.info(res) // 5 +
    +

    Async sources must be awaited:

    +
    import length from 'it-length'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const res = await length(values())

    console.info(res) // 5 +
    +

    it-length

    codecov +CI

    +
    +

    Counts the number of items in an async iterable

    +
    +

    About

    + +

    Counts the number of items in an (async)iterable.

    +

    N.b. will consume the iterable

    +

    Example

    import length from 'it-length'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const res = length(values)

    console.info(res) // 5 +
    +

    Async sources must be awaited:

    +
    import length from 'it-length'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const res = await length(values())

    console.info(res) // 5 +
    +

    Install

    $ npm i it-length
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItLength in the global namespace.

    +
    <script src="https://unpkg.com/it-length/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_length_prefixed_stream.html b/modules/it_length_prefixed_stream.html new file mode 100644 index 00000000..f238cd24 --- /dev/null +++ b/modules/it_length_prefixed_stream.html @@ -0,0 +1,45 @@ +it-length-prefixed-stream | Documentation

    Module it-length-prefixed-stream

    This module makes it easy to send and receive length-prefixed byte arrays over streams.

    +

    Example

    import { lpStream } from 'it-length-prefixed-stream'

    const stream = lpStream(duplex)

    // read the next length-prefixed chunk
    const bytes = await stream.read()

    // write a length-prefixed chunk
    await stream.write(Uint8Array.from([0, 1, 2, 3, 4]))

    // write several chunks, all individually length-prefixed
    await stream.writeV([
    Uint8Array.from([0, 1, 2, 3, 4]),
    Uint8Array.from([5, 6, 7, 8, 9])
    ]) +
    +

    it-length-prefixed-stream

    codecov +CI

    +
    +

    Read and write length-prefixed byte arrays over a duplex stream

    +
    +

    About

    + +

    This module makes it easy to send and receive length-prefixed byte arrays over streams.

    +

    Example

    import { lpStream } from 'it-length-prefixed-stream'

    const stream = lpStream(duplex)

    // read the next length-prefixed chunk
    const bytes = await stream.read()

    // write a length-prefixed chunk
    await stream.write(Uint8Array.from([0, 1, 2, 3, 4]))

    // write several chunks, all individually length-prefixed
    await stream.writeV([
    Uint8Array.from([0, 1, 2, 3, 4]),
    Uint8Array.from([5, 6, 7, 8, 9])
    ]) +
    +

    Install

    $ npm i it-length-prefixed-stream
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItLengthPrefixedStream in the global namespace.

    +
    <script src="https://unpkg.com/it-length-prefixed-stream/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Interfaces

    Functions

    \ No newline at end of file diff --git a/modules/it_map.html b/modules/it_map.html new file mode 100644 index 00000000..4b246b7b --- /dev/null +++ b/modules/it_map.html @@ -0,0 +1,48 @@ +it-map | Documentation

    Module it-map

    Convert one value from an (async)iterator into another.

    +

    Example

    import map from 'it-map'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const result = map(values, (val, index) => val++)

    console.info(result) // [1, 2, 3, 4, 5] +
    +

    Async sources and transforms must be awaited:

    +
    import map from 'it-map'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const result = await map(values(), async (val, index) => val++)

    console.info(result) // [1, 2, 3, 4, 5] +
    +

    it-map

    codecov +CI

    +
    +

    Maps the values yielded by an async iterator

    +
    +

    About

    + +

    Convert one value from an (async)iterator into another.

    +

    Example

    import map from 'it-map'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const result = map(values, (val, index) => val++)

    console.info(result) // [1, 2, 3, 4, 5] +
    +

    Async sources and transforms must be awaited:

    +
    import map from 'it-map'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const result = await map(values(), async (val, index) => val++)

    console.info(result) // [1, 2, 3, 4, 5] +
    +

    Install

    $ npm i it-map
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItMap in the global namespace.

    +
    <script src="https://unpkg.com/it-map/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_merge.html b/modules/it_merge.html new file mode 100644 index 00000000..d4a09bff --- /dev/null +++ b/modules/it_merge.html @@ -0,0 +1,50 @@ +it-merge | Documentation

    Module it-merge

    Merge several (async)iterables into one, yield values as they arrive.

    +

    Nb. sources are iterated over in parallel so the order of emitted items is not guaranteed.

    +

    Example

    import merge from 'it-merge'
    import all from 'it-all'

    // This can also be an iterator, generator, etc
    const values1 = [0, 1, 2, 3, 4]
    const values2 = [5, 6, 7, 8, 9]

    const arr = all(merge(values1, values2))

    console.info(arr) // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 +
    +

    Async sources must be awaited:

    +
    import merge from 'it-merge'
    import all from 'it-all'

    // This can also be an iterator, async iterator, generator, etc
    const values1 = async function * () {
    yield * [0, 1, 2, 3, 4]
    }
    const values2 = async function * () {
    yield * [5, 6, 7, 8, 9]
    }

    const arr = await all(merge(values1(), values2()))

    console.info(arr) // 0, 1, 5, 6, 2, 3, 4, 7, 8, 9 <- nb. order is not guaranteed +
    +

    it-merge

    codecov +CI

    +
    +

    Treat one or more iterables as a single iterable

    +
    +

    About

    + +

    Merge several (async)iterables into one, yield values as they arrive.

    +

    Nb. sources are iterated over in parallel so the order of emitted items is not guaranteed.

    +

    Example

    import merge from 'it-merge'
    import all from 'it-all'

    // This can also be an iterator, generator, etc
    const values1 = [0, 1, 2, 3, 4]
    const values2 = [5, 6, 7, 8, 9]

    const arr = all(merge(values1, values2))

    console.info(arr) // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 +
    +

    Async sources must be awaited:

    +
    import merge from 'it-merge'
    import all from 'it-all'

    // This can also be an iterator, async iterator, generator, etc
    const values1 = async function * () {
    yield * [0, 1, 2, 3, 4]
    }
    const values2 = async function * () {
    yield * [5, 6, 7, 8, 9]
    }

    const arr = await all(merge(values1(), values2()))

    console.info(arr) // 0, 1, 5, 6, 2, 3, 4, 7, 8, 9 <- nb. order is not guaranteed +
    +

    Install

    $ npm i it-merge
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItMerge in the global namespace.

    +
    <script src="https://unpkg.com/it-merge/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_multipart.html b/modules/it_multipart.html new file mode 100644 index 00000000..df4563b2 --- /dev/null +++ b/modules/it_multipart.html @@ -0,0 +1,40 @@ +it-multipart | Documentation

    Module it-multipart

    Allows iterating over multipart messages found in a HTTP request/

    +

    Example

    import http from 'http'
    import multipart from 'it-multipart'

    http.createServer(async (req, res) => {
    if (req.method === 'POST' && req.headers['content-type']) {
    for await (const part of multipart(req)) {
    console.log(`part with HTTP headers ${part.headers}`)

    // nb. part.body must be consumed before the next part is emitted
    for await (const chunk of part.body) {
    console.log(`part with content ${part.name} contents:`, chunk.toString())
    }
    }

    console.log('finished parsing')
    res.writeHead(200)
    res.end()
    }

    res.writeHead(404)
    res.end()
    }).listen(5001, () => {
    console.log('server listening on port 5001')
    }) +
    +

    it-multipart

    codecov +CI

    +
    +

    Async iterable http multipart message parser

    +
    +

    About

    + +

    Allows iterating over multipart messages found in a HTTP request/

    +

    Example

    import http from 'http'
    import multipart from 'it-multipart'

    http.createServer(async (req, res) => {
    if (req.method === 'POST' && req.headers['content-type']) {
    for await (const part of multipart(req)) {
    console.log(`part with HTTP headers ${part.headers}`)

    // nb. part.body must be consumed before the next part is emitted
    for await (const chunk of part.body) {
    console.log(`part with content ${part.name} contents:`, chunk.toString())
    }
    }

    console.log('finished parsing')
    res.writeHead(200)
    res.end()
    }

    res.writeHead(404)
    res.end()
    }).listen(5001, () => {
    console.log('server listening on port 5001')
    }) +
    +

    Install

    $ npm i it-multipart
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Interfaces

    Functions

    \ No newline at end of file diff --git a/modules/it_ndjson.html b/modules/it_ndjson.html new file mode 100644 index 00000000..2530761b --- /dev/null +++ b/modules/it_ndjson.html @@ -0,0 +1,43 @@ +it-ndjson | Documentation

    Module it-ndjson

    Turn (async)iterable values into JSON and back again.

    +

    Example

    import ndjson from 'it-ndjson'
    import all from 'it-all'

    // This can also be an iterator, async iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const arr = await all(ndjson.stringify(values))

    console.info(arr) // '0\n', '1\n', '2\n', '3\n', '4\n'

    const res = await all(ndjson.parse(arr))

    console.info(res) // [0, 1, 2, 3, 4] +
    +

    it-ndjson

    codecov +CI

    +
    +

    Parse iterators as ndjson and transform iterators to ndjson

    +
    +

    About

    + +

    Turn (async)iterable values into JSON and back again.

    +

    Example

    import ndjson from 'it-ndjson'
    import all from 'it-all'

    // This can also be an iterator, async iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const arr = await all(ndjson.stringify(values))

    console.info(arr) // '0\n', '1\n', '2\n', '3\n', '4\n'

    const res = await all(ndjson.parse(arr))

    console.info(res) // [0, 1, 2, 3, 4] +
    +

    Install

    $ npm i it-ndjson
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItNdjson in the global namespace.

    +
    <script src="https://unpkg.com/it-ndjson/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_parallel.html b/modules/it_parallel.html new file mode 100644 index 00000000..ad75a24f --- /dev/null +++ b/modules/it_parallel.html @@ -0,0 +1,49 @@ +it-parallel | Documentation

    Module it-parallel

    Takes an (async) iterable that emits promise-returning functions, invokes them in parallel up to the concurrency limit and emits the results as they become available, optionally in the same order as the input

    +

    Example

    import parallel from 'it-parallel'
    import all from 'it-all'
    import delay from 'delay'

    // This can also be an iterator, async iterator, generator, etc
    const input = [
    async () => {
    console.info('start 1')
    await delay(500)

    console.info('end 1')
    return 1
    },
    async () => {
    console.info('start 2')
    await delay(200)

    console.info('end 2')
    return 2
    },
    async () => {
    console.info('start 3')
    await delay(100)

    console.info('end 3')
    return 3
    }
    ]

    const result = await all(parallel(input, {
    concurrency: 2
    }))

    // output:
    // start 1
    // start 2
    // end 2
    // start 3
    // end 3
    // end 1

    console.info(result) // [2, 3, 1] +
    +

    If order is important, pass ordered: true as an option:

    +
    const result = await all(parallel(input, {
    concurrency: 2,
    ordered: true
    }))

    // output:
    // start 1
    // start 2
    // end 2
    // start 3
    // end 3
    // end 1

    console.info(result) // [1, 2, 3] +
    +

    it-parallel

    codecov +CI

    +
    +

    Process incoming async(iterable) functions in parallel

    +
    +

    About

    + +

    Takes an (async) iterable that emits promise-returning functions, invokes them in parallel up to the concurrency limit and emits the results as they become available, optionally in the same order as the input

    +

    Example

    import parallel from 'it-parallel'
    import all from 'it-all'
    import delay from 'delay'

    // This can also be an iterator, async iterator, generator, etc
    const input = [
    async () => {
    console.info('start 1')
    await delay(500)

    console.info('end 1')
    return 1
    },
    async () => {
    console.info('start 2')
    await delay(200)

    console.info('end 2')
    return 2
    },
    async () => {
    console.info('start 3')
    await delay(100)

    console.info('end 3')
    return 3
    }
    ]

    const result = await all(parallel(input, {
    concurrency: 2
    }))

    // output:
    // start 1
    // start 2
    // end 2
    // start 3
    // end 3
    // end 1

    console.info(result) // [2, 3, 1] +
    +

    If order is important, pass ordered: true as an option:

    +
    const result = await all(parallel(input, {
    concurrency: 2,
    ordered: true
    }))

    // output:
    // start 1
    // start 2
    // end 2
    // start 3
    // end 3
    // end 1

    console.info(result) // [1, 2, 3] +
    +

    Install

    $ npm i it-parallel
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItParallel in the global namespace.

    +
    <script src="https://unpkg.com/it-parallel/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Interfaces

    Functions

    \ No newline at end of file diff --git a/modules/it_parallel_batch.html b/modules/it_parallel_batch.html new file mode 100644 index 00000000..46ce637d --- /dev/null +++ b/modules/it_parallel_batch.html @@ -0,0 +1,44 @@ +it-parallel-batch | Documentation

    Module it-parallel-batch

    Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input.

    +

    The final batch may be smaller than the batch size.

    +

    Example

    import parallelBatch from 'it-parallel-batch'
    import all from 'it-all'
    import delay from 'delay'

    // This can also be an iterator, async iterator, generator, etc
    const input = [
    async () => {
    await delay(500)

    return 1
    },
    async () => {
    await delay(200)

    return 2
    },
    async () => {
    await delay(100)

    return 3
    }
    ]

    const batchSize = 2

    const result = await all(parallelBatch(input, batchSize))

    console.info(result) // [1, 2, 3] +
    +

    it-parallel-batch

    codecov +CI

    +
    +

    Process (async)iterable values as functions with concurrency control

    +
    +

    About

    + +

    Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input.

    +

    The final batch may be smaller than the batch size.

    +

    Example

    import parallelBatch from 'it-parallel-batch'
    import all from 'it-all'
    import delay from 'delay'

    // This can also be an iterator, async iterator, generator, etc
    const input = [
    async () => {
    await delay(500)

    return 1
    },
    async () => {
    await delay(200)

    return 2
    },
    async () => {
    await delay(100)

    return 3
    }
    ]

    const batchSize = 2

    const result = await all(parallelBatch(input, batchSize))

    console.info(result) // [1, 2, 3] +
    +

    Install

    $ npm i it-parallel-batch
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItParallelBatch in the global namespace.

    +
    <script src="https://unpkg.com/it-parallel-batch/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_peekable.html b/modules/it_peekable.html new file mode 100644 index 00000000..391b1041 --- /dev/null +++ b/modules/it_peekable.html @@ -0,0 +1,53 @@ +it-peekable | Documentation

    Module it-peekable

    Lets you look at the contents of an async iterator and decide what to do

    +

    Example

    import peekable from 'it-peekable'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const it = peekable(value)

    const first = it.peek()

    console.info(first) // 0

    it.push(first)

    console.info([...it])
    // [ 0, 1, 2, 3, 4 ] +
    +

    Async sources must be awaited:

    +
    import peekable from 'it-peekable'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const it = peekable(values())

    const first = await it.peek()

    console.info(first) // 0

    it.push(first)

    console.info(await all(it))
    // [ 0, 1, 2, 3, 4 ] +
    +

    it-peekable

    codecov +CI

    +
    +

    Allows peeking/pushing an iterable

    +
    +

    About

    + +

    Lets you look at the contents of an async iterator and decide what to do

    +

    Example

    import peekable from 'it-peekable'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const it = peekable(value)

    const first = it.peek()

    console.info(first) // 0

    it.push(first)

    console.info([...it])
    // [ 0, 1, 2, 3, 4 ] +
    +

    Async sources must be awaited:

    +
    import peekable from 'it-peekable'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const it = peekable(values())

    const first = await it.peek()

    console.info(first) // 0

    it.push(first)

    console.info(await all(it))
    // [ 0, 1, 2, 3, 4 ] +
    +

    Install

    $ npm i it-peekable
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItPeekable in the global namespace.

    +
    <script src="https://unpkg.com/it-peekable/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Interfaces

    Type Aliases

    Functions

    \ No newline at end of file diff --git a/modules/it_protobuf_stream.html b/modules/it_protobuf_stream.html new file mode 100644 index 00000000..12c48a35 --- /dev/null +++ b/modules/it_protobuf_stream.html @@ -0,0 +1,50 @@ +it-protobuf-stream | Documentation

    Module it-protobuf-stream

    This module makes it easy to send and receive length-prefixed Protobuf encoded +messages over streams.

    +

    Example

    import { pbStream } from 'it-protobuf-stream'
    import { MessageType } from './src/my-message-type.js'

    // RequestType and ResponseType have been generate from `.proto` files and have
    // `.encode` and `.decode` methods for serialization/deserialization

    const stream = pbStream(duplex)

    // write a message to the stream
    stream.write({
    foo: 'bar'
    }, MessageType)

    // read a message from the stream
    const res = await stream.read(MessageType) +
    +

    it-protobuf-stream

    codecov +CI

    +
    +

    Read and write protobuf messages over a duplex stream

    +
    +

    About

    + +

    This module makes it easy to send and receive length-prefixed Protobuf encoded +messages over streams.

    +

    Example

    import { pbStream } from 'it-protobuf-stream'
    import { MessageType } from './src/my-message-type.js'

    // RequestType and ResponseType have been generate from `.proto` files and have
    // `.encode` and `.decode` methods for serialization/deserialization

    const stream = pbStream(duplex)

    // write a message to the stream
    stream.write({
    foo: 'bar'
    }, MessageType)

    // read a message from the stream
    const res = await stream.read(MessageType) +
    +

    Install

    $ npm i it-protobuf-stream
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItProtobufStream in the global namespace.

    +
    <script src="https://unpkg.com/it-protobuf-stream/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Interfaces

    Functions

    \ No newline at end of file diff --git a/modules/it_queueless_pushable.html b/modules/it_queueless_pushable.html new file mode 100644 index 00000000..81b45aad --- /dev/null +++ b/modules/it_queueless_pushable.html @@ -0,0 +1,51 @@ +it-queueless-pushable | Documentation

    Module it-queueless-pushable

    A pushable async generator that waits until the current value is consumed +before allowing a new value to be pushed.

    +

    Useful for when you don't want to keep memory usage under control and/or +allow a downstream consumer to dictate how fast data flows through a pipe, +but you want to be able to apply a transform to that data.

    +

    Example

    import { queuelessPushable } from 'it-queueless-pushable'

    const pushable = queuelessPushable<string>()

    // run asynchronously
    Promise.resolve().then(async () => {
    // push a value - the returned promise will not resolve until the value is
    // read from the pushable
    await pushable.push('hello')
    })

    // read a value
    const result = await pushable.next()
    console.info(result) // { done: false, value: 'hello' } +
    +

    it-queueless-pushable

    codecov +CI

    +
    +

    A pushable queue that waits until a value is consumed before accepting another

    +
    +

    About

    + +

    Collects all Uint8Array values from an (async)iterable and returns them as a single Uint8Array.

    +

    Example

    import toBuffer from 'it-to-buffer'

    // This can also be an iterator, generator, etc
    const values = [Buffer.from([0, 1]), Buffer.from([2, 3])]

    const result = toBuffer(values)

    console.info(result) // Buffer[0, 1, 2, 3] +
    +

    Async sources must be awaited:

    +
    import toBuffer from 'it-to-buffer'

    const values = async function * () {
    yield Buffer.from([0, 1])
    yield Buffer.from([2, 3])
    }

    const result = await toBuffer(values())

    console.info(result) // Buffer[0, 1, 2, 3] +
    +

    Install

    $ npm i it-queueless-pushable
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItQueuelessPushable in the global namespace.

    +
    <script src="https://unpkg.com/it-queueless-pushable/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Interfaces

    Functions

    \ No newline at end of file diff --git a/modules/it_reduce.html b/modules/it_reduce.html new file mode 100644 index 00000000..bee4f45e --- /dev/null +++ b/modules/it_reduce.html @@ -0,0 +1,48 @@ +it-reduce | Documentation

    Module it-reduce

    Reduce the values of an (async)iterable to a single value.

    +

    Example

    import reduce from 'it-reduce'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const result = reduce(values, (acc, curr, index) => acc + curr, 0)

    console.info(result) // 10 +
    +

    Async sources must be awaited:

    +
    import reduce from 'it-reduce'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const result = await reduce(values(), (acc, curr, index) => acc + curr, 0)

    console.info(result) // 10 +
    +

    it-reduce

    codecov +CI

    +
    +

    Reduces the values yielded from an async iterator

    +
    +

    About

    + +

    Reduce the values of an (async)iterable to a single value.

    +

    Example

    import reduce from 'it-reduce'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const result = reduce(values, (acc, curr, index) => acc + curr, 0)

    console.info(result) // 10 +
    +

    Async sources must be awaited:

    +
    import reduce from 'it-reduce'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const result = await reduce(values(), (acc, curr, index) => acc + curr, 0)

    console.info(result) // 10 +
    +

    Install

    $ npm i it-reduce
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItReduce in the global namespace.

    +
    <script src="https://unpkg.com/it-reduce/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_rpc.html b/modules/it_rpc.html new file mode 100644 index 00000000..e36dcb68 --- /dev/null +++ b/modules/it_rpc.html @@ -0,0 +1,102 @@ +it-rpc | Documentation

    Module it-rpc

    Your RPC objects must follow a few rules:

    +
      +
    1. All RPC methods must return a promise or an async generator
    2. +
    3. Property access on the RPC object is not supported
    4. +
    5. RPC Arguments must not be promises (though may be functions that return promises)
    6. +
    7. The values resolved/yielded from an RPC function must be serializable (e.g. contain no functions) unless custom types are used (see Custom Types below)
    8. +
    9. AsyncGenerators returned from RPC methods must be either read to completion, or their .return/.throw methods invoked
    10. +
    11. Callback functions (e.g. functions passed as arguments) should return promises or async generators
    12. +
    13. Callback functions may return void, but if so they must not throw
    14. +
    +

    Example: Getting started

    import { rpc } from 'it-rpc'

    // the invocation target interface - used by the client and the server
    interface Target {
    sayHello(): Promise<string>
    }

    // the target implementation, lives on the server side
    const target: Target = {
    async sayHello () {
    return 'hello'
    }
    }

    // create client and server
    const server = rpc()
    const client = rpc()

    // pipe the streams together
    void server.sink(client.source)
    void client.sink(server.source)

    // a string that is the same on both the server and the client
    const objectName = 'target'

    // expose target implementation to RPC calls on the server side
    server.createTarget(objectName, target)

    // create a client-side version of target
    const clientTarget = client.createClient<Target>(objectName)

    // invoke a remote method
    await clientTarget.sayHello() // 'hello' +
    +

    Example: Streaming data from the server to the client

    import { rpc } from 'it-rpc'

    interface Target {
    streamingMethod(): AsyncGenerator<Uint8Array>
    }

    const target: Target = {
    async * streamingMethod () {
    yield Uint8Array.from([0, 1, 2, 3])
    yield Uint8Array.from([4, 5, 6, 7])
    }
    }

    const server = rpc()
    const client = rpc()
    void server.sink(client.source)
    void client.sink(server.source)

    const objectName = 'target'
    server.createTarget(objectName, target)

    const clientTarget = client.createClient<Target>(objectName)

    for await (const buf of clientTarget.streamingMethod()) {
    console.info(buf)
    // Uint8Array([0, 1, 2, 3])
    // Uint8Array([4, 5, 6, 7])
    } +
    +

    Example: Aborting remote method invocations

    Any abort signals passed as arguments will have equivalents passed on to the +remote method invocation and these will fire their abort event when the +client side signal fires.

    +
    import { rpc } from 'it-rpc'

    interface Target {
    slowStream(arg: { signal: AbortSignal }): AsyncGenerator<Uint8Array>
    }

    const target: Target = {
    async * slowStream () {
    await new Promise<void>((resolve) => {
    setTimeout(() => {
    resolve()
    }, 5000)
    })
    yield Uint8Array.from([0, 1, 2, 3])
    yield Uint8Array.from([4, 5, 6, 7])
    }
    }

    const server = rpc()
    const client = rpc()
    void server.sink(client.source)
    void client.sink(server.source)

    const objectName = 'target'
    server.createTarget(objectName, target)

    const clientTarget = client.createClient<Target>(objectName)

    const signal = AbortSignal.timeout(1000)

    for await (const buf of clientTarget.slowStream({ signal })) {
    console.info(buf)
    // explodes after 1s
    } +
    +

    Custom types

    It is possible to extend it-rpc to support serializing/deserializing custom types by passing ValueCodecs to the constructor.

    +

    Each ValueCodec needs a unique type field which identifies the value type on the wire.

    +

    it-rpc uses value types starting at 1024 and has a catch-all 2147483647 type which resolves to plain objects.

    +

    You should define your type values higher than the max value it-rpc uses (2048 is a safe value) but lower than the catch-all type value.

    +

    Matching codecs are searched for in type order so you can override the built-in codecs by specifying a type field lower than 1024.

    +
    +

    [!IMPORTANT] +Both the server and the client must be configured with the same set of custom ValueCodecs

    +
    +

    Example: Custom Types

    import { encode, decode } from 'cborg'
    import { rpc } from 'it-rpc'
    import type { ValueCodec } from 'it-rpc'

    // a custom type we want to encode
    class MyClass {
    field: string

    constructor (val: string) {
    this.field = val
    }

    getField () {
    return this.field
    }
    }

    // our custom codec
    const codec: ValueCodec<MyClass> = {
    type: 2048,
    canEncode: (val) => val instanceof MyClass,
    encode: (val) => encode({ field: val.getField() }),
    decode: (buf) => {
    const decoded = decode(buf)

    return new MyClass(decoded.field)
    }
    }

    // configure the server/client with the custom codec
    const server = rpc({
    valueCodecs: [
    codec
    ]
    })
    const client = rpc({
    valueCodecs: [
    codec
    ]
    })
    void server.sink(client.source)
    void client.sink(server.source)

    interface Target {
    getFieldFromArg(arg: MyClass): Promise<string>
    }

    const target: Target = {
    async getFieldFromArg (arg) {
    return arg.getField()
    }
    }

    const objectName = 'target'
    server.createTarget(objectName, target)

    const clientTarget = client.createClient<Target>(objectName)

    const val = new MyClass('hello')

    await clientTarget.getFieldFromArg(val) // 'hello' +
    +

    it-rpc

    codecov +CI

    +
    +

    Schema-free RPC over async iterables

    +
    +

    About

    + +

    Your RPC objects must follow a few rules:

    +
      +
    1. All RPC methods must return a promise or an async generator
    2. +
    3. Property access on the RPC object is not supported
    4. +
    5. RPC Arguments must not be promises (though may be functions that return promises)
    6. +
    7. The values resolved/yielded from an RPC function must be serializable (e.g. contain no functions) unless custom types are used (see Custom Types below)
    8. +
    9. AsyncGenerators returned from RPC methods must be either read to completion, or their .return/.throw methods invoked
    10. +
    11. Callback functions (e.g. functions passed as arguments) should return promises or async generators
    12. +
    13. Callback functions may return void, but if so they must not throw
    14. +
    +

    Example - Getting started

    import { rpc } from 'it-rpc'

    // the invocation target interface - used by the client and the server
    interface Target {
    sayHello(): Promise<string>
    }

    // the target implementation, lives on the server side
    const target: Target = {
    async sayHello () {
    return 'hello'
    }
    }

    // create client and server
    const server = rpc()
    const client = rpc()

    // pipe the streams together
    void server.sink(client.source)
    void client.sink(server.source)

    // a string that is the same on both the server and the client
    const objectName = 'target'

    // expose target implementation to RPC calls on the server side
    server.createTarget(objectName, target)

    // create a client-side version of target
    const clientTarget = client.createClient<Target>(objectName)

    // invoke a remote method
    await clientTarget.sayHello() // 'hello' +
    +

    Example - Streaming data from the server to the client

    import { rpc } from 'it-rpc'

    interface Target {
    streamingMethod(): AsyncGenerator<Uint8Array>
    }

    const target: Target = {
    async * streamingMethod () {
    yield Uint8Array.from([0, 1, 2, 3])
    yield Uint8Array.from([4, 5, 6, 7])
    }
    }

    const server = rpc()
    const client = rpc()
    void server.sink(client.source)
    void client.sink(server.source)

    const objectName = 'target'
    server.createTarget(objectName, target)

    const clientTarget = client.createClient<Target>(objectName)

    for await (const buf of clientTarget.streamingMethod()) {
    console.info(buf)
    // Uint8Array([0, 1, 2, 3])
    // Uint8Array([4, 5, 6, 7])
    } +
    +

    Example - Aborting remote method invocations

    Any abort signals passed as arguments will have equivalents passed on to the +remote method invocation and these will fire their abort event when the +client side signal fires.

    +
    import { rpc } from 'it-rpc'

    interface Target {
    slowStream(arg: { signal: AbortSignal }): AsyncGenerator<Uint8Array>
    }

    const target: Target = {
    async * slowStream () {
    await new Promise<void>((resolve) => {
    setTimeout(() => {
    resolve()
    }, 5000)
    })
    yield Uint8Array.from([0, 1, 2, 3])
    yield Uint8Array.from([4, 5, 6, 7])
    }
    }

    const server = rpc()
    const client = rpc()
    void server.sink(client.source)
    void client.sink(server.source)

    const objectName = 'target'
    server.createTarget(objectName, target)

    const clientTarget = client.createClient<Target>(objectName)

    const signal = AbortSignal.timeout(1000)

    for await (const buf of clientTarget.slowStream({ signal })) {
    console.info(buf)
    // explodes after 1s
    } +
    +

    Custom types

    It is possible to extend it-rpc to support serializing/deserializing custom types by passing ValueCodecs to the constructor.

    +

    Each ValueCodec needs a unique type field which identifies the value type on the wire.

    +

    it-rpc uses value types starting at 1024 and has a catch-all 2147483647 type which resolves to plain objects.

    +

    You should define your type values higher than the max value it-rpc uses (2048 is a safe value) but lower than the catch-all type value.

    +

    Matching codecs are searched for in type order so you can override the built-in codecs by specifying a type field lower than 1024.

    +
    +

    [!IMPORTANT] +Both the server and the client must be configured with the same set of custom ValueCodecs

    +
    +

    Example - Custom Types

    import { encode, decode } from 'cborg'
    import { rpc } from 'it-rpc'
    import type { ValueCodec } from 'it-rpc'

    // a custom type we want to encode
    class MyClass {
    field: string

    constructor (val: string) {
    this.field = val
    }

    getField () {
    return this.field
    }
    }

    // our custom codec
    const codec: ValueCodec<MyClass> = {
    type: 2048,
    canEncode: (val) => val instanceof MyClass,
    encode: (val) => encode({ field: val.getField() }),
    decode: (buf) => {
    const decoded = decode(buf)

    return new MyClass(decoded.field)
    }
    }

    // configure the server/client with the custom codec
    const server = rpc({
    valueCodecs: [
    codec
    ]
    })
    const client = rpc({
    valueCodecs: [
    codec
    ]
    })
    void server.sink(client.source)
    void client.sink(server.source)

    interface Target {
    getFieldFromArg(arg: MyClass): Promise<string>
    }

    const target: Target = {
    async getFieldFromArg (arg) {
    return arg.getField()
    }
    }

    const objectName = 'target'
    server.createTarget(objectName, target)

    const clientTarget = client.createClient<Target>(objectName)

    const val = new MyClass('hello')

    await clientTarget.getFieldFromArg(val) // 'hello' +
    +

    Install

    $ npm i it-rpc
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItRpc in the global namespace.

    +
    <script src="https://unpkg.com/it-rpc/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Interfaces

    Functions

    rpc +
    \ No newline at end of file diff --git a/modules/it_skip.html b/modules/it_skip.html new file mode 100644 index 00000000..c372fe7b --- /dev/null +++ b/modules/it_skip.html @@ -0,0 +1,48 @@ +it-skip | Documentation

    Module it-skip

    For when you are only interested in later values from an (async)iterable.

    +

    Example

    import take from 'it-skip'
    import all from 'it-all'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const arr = all(skip(values, 2))

    console.info(arr) // 2, 3, 4 +
    +

    Async sources must be awaited:

    +
    import take from 'it-skip'
    import all from 'it-all'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const arr = await all(skip(values(), 2))

    console.info(arr) // 2, 3, 4 +
    +

    it-skip

    codecov +CI

    +
    +

    Skip items from an iterable

    +
    +

    About

    + +

    For when you are only interested in later values from an (async)iterable.

    +

    Example

    import take from 'it-skip'
    import all from 'it-all'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const arr = all(skip(values, 2))

    console.info(arr) // 2, 3, 4 +
    +

    Async sources must be awaited:

    +
    import take from 'it-skip'
    import all from 'it-all'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const arr = await all(skip(values(), 2))

    console.info(arr) // 2, 3, 4 +
    +

    Install

    $ npm i it-skip
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItSkip in the global namespace.

    +
    <script src="https://unpkg.com/it-skip/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_sort.html b/modules/it_sort.html new file mode 100644 index 00000000..edd3ae68 --- /dev/null +++ b/modules/it_sort.html @@ -0,0 +1,49 @@ +it-sort | Documentation

    Module it-sort

    Consumes all values from an (async)iterable and returns them sorted by the passed sort function.

    +

    Example

    import sort from 'it-sort'
    import all from 'it-all'

    const sorter = (a, b) => {
    return a.localeCompare(b)
    }

    // This can also be an iterator, generator, etc
    const values = ['foo', 'bar']

    const arr = all(sort(values, sorter))

    console.info(arr) // 'bar', 'foo' +
    +

    Async sources must be awaited:

    +
    import sort from 'it-sort'
    import all from 'it-all'

    const sorter = (a, b) => {
    return a.localeCompare(b)
    }

    const values = async function * () {
    yield * ['foo', 'bar']
    }

    const arr = await all(sort(values, sorter))

    console.info(arr) // 'bar', 'foo' +
    +

    it-sort

    codecov +CI

    +
    +

    Collects all values from an async iterator, sorts them using the passed function and yields them

    +
    +

    About

    + +

    Consumes all values from an (async)iterable and returns them sorted by the passed sort function.

    +

    Example

    import sort from 'it-sort'
    import all from 'it-all'

    const sorter = (a, b) => {
    return a.localeCompare(b)
    }

    // This can also be an iterator, generator, etc
    const values = ['foo', 'bar']

    const arr = all(sort(values, sorter))

    console.info(arr) // 'bar', 'foo' +
    +

    Async sources must be awaited:

    +
    import sort from 'it-sort'
    import all from 'it-all'

    const sorter = (a, b) => {
    return a.localeCompare(b)
    }

    const values = async function * () {
    yield * ['foo', 'bar']
    }

    const arr = await all(sort(values, sorter))

    console.info(arr) // 'bar', 'foo' +
    +

    Install

    $ npm i it-sort
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItSort in the global namespace.

    +
    <script src="https://unpkg.com/it-sort/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Interfaces

    Functions

    \ No newline at end of file diff --git a/modules/it_split.html b/modules/it_split.html new file mode 100644 index 00000000..59296d56 --- /dev/null +++ b/modules/it_split.html @@ -0,0 +1,55 @@ +it-split | Documentation

    Module it-split

    Searches Uint8Arrays emitted by an (async)iterable for a delimiter and yields chunks split by that delimiter.

    +

    Example

    import split from 'it-split'

    const encoder = new TextEncoder()

    // This can also be an iterator, generator, etc
    const values = [
    encoder.encode('hello\nwor'),
    encoder.encode('ld')
    ]

    const arr = all(split(values))

    console.info(arr) // [encoder.encode('hello'), encoder.encode('world')] +
    +

    You can also split by arbitrary delimiters:

    +
    const values = [
    Uint8Array.from([0, 1, 2, 3]),
    Uint8Array.from([0, 1, 2, 3]),
    Uint8Array.from([1, 1, 2])
    ]
    const delimiter = Uint8Array.from([1, 2])

    const arr = all(split(values, {
    delimiter
    }))

    console.info(arr) // [ Buffer.from([0]), Buffer.from([3, 0]), Buffer.from([3, 1]) ] +
    +

    Async sources must be awaited:

    +
    import split from 'it-split'

    const encoder = new TextEncoder()

    const values = async function * () {
    yield * [
    encoder.encode('hello\nwor'),
    encoder.encode('ld')
    ]
    }

    const arr = await all(split(values()))

    console.info(arr) // [encoder.encode('hello'), encoder.encode('world')] +
    +

    it-split

    codecov +CI

    +
    +

    Splits Uint8Arrays emitted by an (async) iterable by a delimiter

    +
    +

    About

    + +

    Searches Uint8Arrays emitted by an (async)iterable for a delimiter and yields chunks split by that delimiter.

    +

    Example

    import split from 'it-split'

    const encoder = new TextEncoder()

    // This can also be an iterator, generator, etc
    const values = [
    encoder.encode('hello\nwor'),
    encoder.encode('ld')
    ]

    const arr = all(split(values))

    console.info(arr) // [encoder.encode('hello'), encoder.encode('world')] +
    +

    You can also split by arbitrary delimiters:

    +
    const values = [
    Uint8Array.from([0, 1, 2, 3]),
    Uint8Array.from([0, 1, 2, 3]),
    Uint8Array.from([1, 1, 2])
    ]
    const delimiter = Uint8Array.from([1, 2])

    const arr = all(split(values, {
    delimiter
    }))

    console.info(arr) // [ Buffer.from([0]), Buffer.from([3, 0]), Buffer.from([3, 1]) ] +
    +

    Async sources must be awaited:

    +
    import split from 'it-split'

    const encoder = new TextEncoder()

    const values = async function * () {
    yield * [
    encoder.encode('hello\nwor'),
    encoder.encode('ld')
    ]
    }

    const arr = await all(split(values()))

    console.info(arr) // [encoder.encode('hello'), encoder.encode('world')] +
    +

    Install

    $ npm i it-split
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItSplit in the global namespace.

    +
    <script src="https://unpkg.com/it-split/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Interfaces

    Functions

    \ No newline at end of file diff --git a/modules/it_take.html b/modules/it_take.html new file mode 100644 index 00000000..7bb31ccf --- /dev/null +++ b/modules/it_take.html @@ -0,0 +1,48 @@ +it-take | Documentation

    Module it-take

    For when you only want a few values out of an (async)iterable.

    +

    Example

    import take from 'it-take'
    import all from 'it-all'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const arr = all(take(values, 2))

    console.info(arr) // 0, 1 +
    +

    Async sources must be awaited:

    +
    import take from 'it-take'
    import all from 'it-all'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const arr = await all(take(values(), 2))

    console.info(arr) // 0, 1 +
    +

    it-take

    codecov +CI

    +
    +

    Stop iteration after n items have been received

    +
    +

    About

    + +

    For when you only want a few values out of an (async)iterable.

    +

    Example

    import take from 'it-take'
    import all from 'it-all'

    // This can also be an iterator, generator, etc
    const values = [0, 1, 2, 3, 4]

    const arr = all(take(values, 2))

    console.info(arr) // 0, 1 +
    +

    Async sources must be awaited:

    +
    import take from 'it-take'
    import all from 'it-all'

    const values = async function * () {
    yield * [0, 1, 2, 3, 4]
    }

    const arr = await all(take(values(), 2))

    console.info(arr) // 0, 1 +
    +

    Install

    $ npm i it-take
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItTake in the global namespace.

    +
    <script src="https://unpkg.com/it-take/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_to_browser_readablestream.html b/modules/it_to_browser_readablestream.html new file mode 100644 index 00000000..f6c15b71 --- /dev/null +++ b/modules/it_to_browser_readablestream.html @@ -0,0 +1,42 @@ +it-to-browser-readablestream | Documentation

    Module it-to-browser-readablestream

    Turns an (async)iterable into a W3C ReadbleStream.

    +

    Example

    import toBrowserReadableStream from 'it-to-browser-readablestream'

    // This can also be an iterator, async iterator, generator, etc
    const values = [Buffer.from([0, 1]), Buffer.from([2, 3])]

    const stream = await toBrowserReadableStream(values)

    for await (const buf of stream) {
    console.info(buf) // Buffer[0, 1]
    } +
    +

    it-to-browser-readablestream

    codecov +CI

    +
    +

    Takes an async iterator and turns it into a browser readable stream

    +
    +

    About

    + +

    Turns an (async)iterable into a W3C ReadbleStream.

    +

    Example

    import toBrowserReadableStream from 'it-to-browser-readablestream'

    // This can also be an iterator, async iterator, generator, etc
    const values = [Buffer.from([0, 1]), Buffer.from([2, 3])]

    const stream = await toBrowserReadableStream(values)

    for await (const buf of stream) {
    console.info(buf) // Buffer[0, 1]
    } +
    +

    Install

    $ npm i it-to-browser-readablestream
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItToBrowserReadablestream in the global namespace.

    +
    <script src="https://unpkg.com/it-to-browser-readablestream/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/modules/it_to_buffer.html b/modules/it_to_buffer.html new file mode 100644 index 00000000..bef573d2 --- /dev/null +++ b/modules/it_to_buffer.html @@ -0,0 +1,48 @@ +it-to-buffer | Documentation

    Module it-to-buffer

    Collects all Uint8Array values from an (async)iterable and returns them as a single Uint8Array.

    +

    Example

    import toBuffer from 'it-to-buffer'

    // This can also be an iterator, generator, etc
    const values = [Buffer.from([0, 1]), Buffer.from([2, 3])]

    const result = toBuffer(values)

    console.info(result) // Buffer[0, 1, 2, 3] +
    +

    Async sources must be awaited:

    +
    import toBuffer from 'it-to-buffer'

    const values = async function * () {
    yield Buffer.from([0, 1])
    yield Buffer.from([2, 3])
    }

    const result = await toBuffer(values())

    console.info(result) // Buffer[0, 1, 2, 3] +
    +

    it-to-buffer

    codecov +CI

    +
    +

    Takes an async iterator that yields buffers and concatenates them all together

    +
    +

    About

    + +

    Collects all Uint8Array values from an (async)iterable and returns them as a single Uint8Array.

    +

    Example

    import toBuffer from 'it-to-buffer'

    // This can also be an iterator, generator, etc
    const values = [Buffer.from([0, 1]), Buffer.from([2, 3])]

    const result = toBuffer(values)

    console.info(result) // Buffer[0, 1, 2, 3] +
    +

    Async sources must be awaited:

    +
    import toBuffer from 'it-to-buffer'

    const values = async function * () {
    yield Buffer.from([0, 1])
    yield Buffer.from([2, 3])
    }

    const result = await toBuffer(values())

    console.info(result) // Buffer[0, 1, 2, 3] +
    +

    Install

    $ npm i it-to-buffer
    +
    +

    Browser <script> tag

    Loading this module through a script tag will make it's exports available as ItToBuffer in the global namespace.

    +
    <script src="https://unpkg.com/it-to-buffer/dist/index.min.js"></script>
    +
    +

    API Docs

    +

    License

    Licensed under either of

    + +

    Contribution

    Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

    +

    Index

    Functions

    \ No newline at end of file diff --git a/types/it_glob.Options.html b/types/it_glob.Options.html new file mode 100644 index 00000000..5e2db960 --- /dev/null +++ b/types/it_glob.Options.html @@ -0,0 +1 @@ +Options | Documentation

    Type alias Options

    \ No newline at end of file diff --git a/types/it_peekable.AsyncPeekable.html b/types/it_peekable.AsyncPeekable.html new file mode 100644 index 00000000..abc82145 --- /dev/null +++ b/types/it_peekable.AsyncPeekable.html @@ -0,0 +1 @@ +AsyncPeekable | Documentation

    Type alias AsyncPeekable<T>

    AsyncPeekable<T>: AsyncIterable<T> & AsyncPeek<T> & Push<T> & AsyncIterator<T>

    Type Parameters

    • T
    \ No newline at end of file diff --git a/types/it_peekable.Peekable.html b/types/it_peekable.Peekable.html new file mode 100644 index 00000000..9ec108bf --- /dev/null +++ b/types/it_peekable.Peekable.html @@ -0,0 +1 @@ +Peekable | Documentation

    Type alias Peekable<T>

    Peekable<T>: Iterable<T> & Peek<T> & Push<T> & Iterator<T>

    Type Parameters

    • T
    \ No newline at end of file