http2lite
v0.0.10
Published
http2 in browser streams
Downloads
1
Readme
Http2Lite
zero dependency tools for DIY http2 in node or browser (with a build tool that understands require)
TODO
- more documentation
- fix "code smells"
- put something meaningful into the readme
- build a simple default hpack context
- add an example (or two)
- fix generated API documentation
API
Table of Contents
- H2LSession
- H2LStream
- Request
- decodeRequest
- encodeRequest
- decodeFrameHeader
- FrameHeader
- encodeFrameHeader
- decodeFlags
- Flags
- decodePriority
- Priority
- encodePriority
- alloc
- allocUnsafe
- readUInt8
- readUInt24BE
- readUInt32BE
- writeUInt8
- writeUInt24BE
- writeUInt32BE
- concat
H2LSession
Extends Emitter
Muxes and demuxes
Parameters
nextStreamId
Number default is 1 for client, passing 2 would be for server (optional, default1
)
writeFrame
Emit any new http messages. Emit new streams when necessary.
Parameters
frame
Uint8Array partial and/or multiple encoded http messages
request
Returns H2LStream
H2LStream
Extends Emitter
Gateway for reading from and writing to virtual streams
Parameters
h2LSession
H2LSessionstreamId
Number
writeRequest
Encode http-like request and mux it into the output stream
Parameters
request
Request
Type: Object
Properties
type
NumberstreamId
NumberpadLength
Numberpayload
Uint8ArraybytesRead
Number
decodeRequest
Parameters
ui8a
Uint8Array
Returns Request
encodeRequest
Parameters
request
Request
Returns Uint8Array
decodeFrameHeader
Parameters
ui8a
Uint8Array
Returns FrameHeader
FrameHeader
Type: Object
Properties
encodeFrameHeader
Parameters
frameHeader
FrameHeader
Returns Uint8Array
decodeFlags
Parameters
ui8
Number
Returns Flags
Flags
Type: Object
Properties
decodePriority
Parameters
ui8a
Uint8Array
Returns Priority
Priority
Type: Object
Properties
encodePriority
Parameters
priority
Priority
Returns Uint8Array
alloc
Parameters
size
Number
Returns Uint8Array
allocUnsafe
Parameters
size
Number
Returns Uint8Array
readUInt8
Parameters
ui8a
Uint8Arrayoffset
Number
Returns Number
readUInt24BE
Parameters
ui8a
Uint8Arrayoffset
Number
Returns Number
readUInt32BE
Parameters
ui8a
Uint8Arrayoffset
Number
Returns Number
writeUInt8
Parameters
ui8a
Uint8Arrayvalue
Numberoffset
Number
writeUInt24BE
Parameters
ui8a
Uint8Arrayvalue
Numberoffset
Number
writeUInt32BE
Parameters
ui8a
Uint8Arrayvalue
Numberoffset
Number
concat
Parameters
ui8as
Array<Uint8Array>
Returns Uint8Array