@libp2p/interface 3.0.0-de2ad9ca5 → 3.0.1-72a7ea10a

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.
@@ -114,6 +114,14 @@ export interface MessageStream<Timeline extends MessageStreamTimeline = MessageS
114
114
  * again to resume sending.
115
115
  */
116
116
  writableNeedsDrain: boolean;
117
+ /**
118
+ * Returns the number of bytes that are queued to be read
119
+ */
120
+ readBufferLength: number;
121
+ /**
122
+ * Returns the number of bytes that are queued to be written
123
+ */
124
+ writeBufferLength: number;
117
125
  /**
118
126
  * Write data to the stream. If the method returns false it means the
119
127
  * internal buffer is now full and the caller should wait for the 'drain'
@@ -155,5 +163,15 @@ export interface MessageStream<Timeline extends MessageStreamTimeline = MessageS
155
163
  * next tick or sooner if data is received from the underlying resource.
156
164
  */
157
165
  push(buf: Uint8Array | Uint8ArrayList): void;
166
+ /**
167
+ * Similar to the `.push` method, except this ensures the passed data is
168
+ * emitted before any other queued data.
169
+ */
170
+ unshift(data: Uint8Array | Uint8ArrayList): void;
171
+ /**
172
+ * Returns a promise that resolves when the stream can accept new data or
173
+ * rejects if the stream is closed or reset before this occurs.
174
+ */
175
+ onDrain(options?: AbortOptions): Promise<void>;
158
176
  }
159
177
  //# sourceMappingURL=message-stream.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message-stream.d.ts","sourceRoot":"","sources":["../../src/message-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,UAAU,CAAA;AAE3D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GA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;;OAGG;IACH,OAAO,CAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAChD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/interface",
3
- "version": "3.0.0-de2ad9ca5",
3
+ "version": "3.0.1-72a7ea10a",
4
4
  "description": "The interface implemented by a libp2p node",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/interface#readme",
@@ -134,6 +134,16 @@ export interface MessageStream<Timeline extends MessageStreamTimeline = MessageS
134
134
  */
135
135
  writableNeedsDrain: boolean
136
136
 
137
+ /**
138
+ * Returns the number of bytes that are queued to be read
139
+ */
140
+ readBufferLength: number
141
+
142
+ /**
143
+ * Returns the number of bytes that are queued to be written
144
+ */
145
+ writeBufferLength: number
146
+
137
147
  /**
138
148
  * Write data to the stream. If the method returns false it means the
139
149
  * internal buffer is now full and the caller should wait for the 'drain'
@@ -180,4 +190,16 @@ export interface MessageStream<Timeline extends MessageStreamTimeline = MessageS
180
190
  * next tick or sooner if data is received from the underlying resource.
181
191
  */
182
192
  push (buf: Uint8Array | Uint8ArrayList): void
193
+
194
+ /**
195
+ * Similar to the `.push` method, except this ensures the passed data is
196
+ * emitted before any other queued data.
197
+ */
198
+ unshift (data: Uint8Array | Uint8ArrayList): void
199
+
200
+ /**
201
+ * Returns a promise that resolves when the stream can accept new data or
202
+ * rejects if the stream is closed or reset before this occurs.
203
+ */
204
+ onDrain (options?: AbortOptions): Promise<void>
183
205
  }