FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
msgpack-javascript/src/decodeAsync.ts at master · somebee/msgpack-javascript · GitHub
somebee
/
msgpack-javascript
Public
forked from
msgpack/msgpack-javascript
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
msgpack-javascript
/
src
/
decodeAsync.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (52 loc) · 1.85 KB
Breadcrumbs
msgpack-javascript
/
src
/
decodeAsync.ts
Copy path
File metadata and controls
60 lines (52 loc) · 1.85 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import
{
Decoder
}
from
"./Decoder"
;
import
{
defaultDecodeOptions
,
DecodeOptions
}
from
"./decode"
;
import
{
ensureAsyncIterabe
,
ReadableStreamLike
}
from
"./utils/stream"
;
import
{
SplitUndefined
}
from
"./context"
;
export
async
function
decodeAsync
<
ContextType
>
(
streamLike
:
ReadableStreamLike
<
ArrayLike
<
number
>
>
,
options
:
DecodeOptions
<
SplitUndefined
<
ContextType
>
>
=
defaultDecodeOptions
as
any
,
)
:
Promise
<
unknown
>
{
const
stream
=
ensureAsyncIterabe
(
streamLike
)
;
const
decoder
=
new
Decoder
<
ContextType
>
(
options
.
extensionCodec
,
(
options
as
typeof
options
&
{
context
:
any
}
)
.
context
,
options
.
maxStrLength
,
options
.
maxBinLength
,
options
.
maxArrayLength
,
options
.
maxMapLength
,
options
.
maxExtLength
,
)
;
return
decoder
.
decodeAsync
(
stream
)
;
}
export
function
decodeArrayStream
<
ContextType
>
(
streamLike
:
ReadableStreamLike
<
ArrayLike
<
number
>
>
,
options
:
DecodeOptions
<
SplitUndefined
<
ContextType
>
>
=
defaultDecodeOptions
as
any
,
)
{
const
stream
=
ensureAsyncIterabe
(
streamLike
)
;
const
decoder
=
new
Decoder
<
ContextType
>
(
options
.
extensionCodec
,
(
options
as
typeof
options
&
{
context
:
any
}
)
.
context
,
options
.
maxStrLength
,
options
.
maxBinLength
,
options
.
maxArrayLength
,
options
.
maxMapLength
,
options
.
maxExtLength
,
)
;
return
decoder
.
decodeArrayStream
(
stream
)
;
}
export
function
decodeStream
<
ContextType
>
(
streamLike
:
ReadableStreamLike
<
ArrayLike
<
number
>
>
,
options
:
DecodeOptions
<
SplitUndefined
<
ContextType
>
>
=
defaultDecodeOptions
as
any
,
)
{
const
stream
=
ensureAsyncIterabe
(
streamLike
)
;
const
decoder
=
new
Decoder
<
ContextType
>
(
options
.
extensionCodec
,
(
options
as
typeof
options
&
{
context
:
any
}
)
.
context
,
options
.
maxStrLength
,
options
.
maxBinLength
,
options
.
maxArrayLength
,
options
.
maxMapLength
,
options
.
maxExtLength
,
)
;
return
decoder
.
decodeStream
(
stream
)
;
}
Back
|
FazBrowse Home
|
New Git URL