starpc 0.10.4 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/srpc/stream.d.ts +1 -0
- package/dist/srpc/stream.js +6 -1
- package/package.json +1 -1
- package/srpc/stream.ts +7 -0
package/dist/srpc/stream.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ import { Uint8ArrayList } from 'uint8arraylist';
|
|
|
4
4
|
export declare type PacketHandler = (packet: Packet) => Promise<void>;
|
|
5
5
|
export declare type Stream = Duplex<Uint8ArrayList | Uint8Array, Uint8Array>;
|
|
6
6
|
export declare type OpenStreamFunc = () => Promise<Stream>;
|
|
7
|
+
export declare function streamToUint8ArrayDuplex(stream: Stream): Duplex<Uint8Array, Uint8Array>;
|
package/dist/srpc/stream.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// streamToUint8ArrayDuplex converts a Stream to a Duplex<Uint8Array>
|
|
2
|
+
// This should be possible without the cast:
|
|
3
|
+
// https://github.com/achingbrain/it-stream-types/issues/28
|
|
4
|
+
export function streamToUint8ArrayDuplex(stream) {
|
|
5
|
+
return stream; // eslint-disable-line
|
|
6
|
+
}
|
package/package.json
CHANGED
package/srpc/stream.ts
CHANGED
|
@@ -10,3 +10,10 @@ export type Stream = Duplex<Uint8ArrayList | Uint8Array, Uint8Array>
|
|
|
10
10
|
|
|
11
11
|
// OpenStreamFunc is a function to start a new RPC by opening a Stream.
|
|
12
12
|
export type OpenStreamFunc = () => Promise<Stream>
|
|
13
|
+
|
|
14
|
+
// streamToUint8ArrayDuplex converts a Stream to a Duplex<Uint8Array>
|
|
15
|
+
// This should be possible without the cast:
|
|
16
|
+
// https://github.com/achingbrain/it-stream-types/issues/28
|
|
17
|
+
export function streamToUint8ArrayDuplex(stream: Stream): Duplex<Uint8Array, Uint8Array> {
|
|
18
|
+
return stream as Duplex<Uint8Array> // eslint-disable-line
|
|
19
|
+
}
|