File tree 2 files changed +61
-0
lines changed
2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,20 @@ exports.pipe = function (r) {
107
107
} ;
108
108
} ;
109
109
110
+ exports . unpipe = function ( r ) {
111
+ return function ( w ) {
112
+ return function ( ) {
113
+ return r . unpipe ( w ) ;
114
+ } ;
115
+ } ;
116
+ } ;
117
+
118
+ exports . unpipeAll = function ( r ) {
119
+ return function ( ) {
120
+ return r . unpipe ( ) ;
121
+ } ;
122
+ } ;
123
+
110
124
exports . readImpl = function ( readChunk ) {
111
125
return function ( Nothing ) {
112
126
return function ( Just ) {
@@ -177,3 +191,17 @@ exports.end = function (w) {
177
191
} ;
178
192
} ;
179
193
} ;
194
+
195
+ exports . destroy = function ( strm ) {
196
+ return function ( ) {
197
+ strm . destroy ( null ) ;
198
+ } ;
199
+ } ;
200
+
201
+ exports . destroyWithError = function ( strm ) {
202
+ return function ( e ) {
203
+ return function ( ) {
204
+ strm . destroy ( e ) ;
205
+ } ;
206
+ } ;
207
+ } ;
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ module Node.Stream
20
20
, pause
21
21
, isPaused
22
22
, pipe
23
+ , unpipe
24
+ , unpipeAll
23
25
, read
24
26
, readString
25
27
, readEither
@@ -29,6 +31,7 @@ module Node.Stream
29
31
, uncork
30
32
, setDefaultEncoding
31
33
, end
34
+ , destroy
32
35
) where
33
36
34
37
import Prelude
@@ -234,6 +237,19 @@ foreign import pipe
234
237
-> Writable r eff
235
238
-> Eff eff (Writable r eff )
236
239
240
+ -- | Detach a Writable stream previously attached using `pipe`.
241
+ foreign import unpipe
242
+ :: forall r w eff
243
+ . Readable w eff
244
+ -> Writable r eff
245
+ -> Eff eff Unit
246
+
247
+ -- | Detach all Writable streams previously attached using `pipe`.
248
+ foreign import unpipeAll
249
+ :: forall w eff
250
+ . Readable w eff
251
+ -> Eff eff Unit
252
+
237
253
-- | Write a Buffer to a writable stream.
238
254
foreign import write
239
255
:: forall r eff
@@ -290,3 +306,20 @@ foreign import end
290
306
. Writable r eff
291
307
-> Eff eff Unit
292
308
-> Eff eff Unit
309
+
310
+ -- | Destroy the stream. It will release any internal resources.
311
+ --
312
+ -- Added in node 8.0.
313
+ foreign import destroy
314
+ :: forall r eff
315
+ . Stream r eff
316
+ -> Eff eff Unit
317
+
318
+ -- | Destroy the stream and emit 'error'.
319
+ --
320
+ -- Added in node 8.0.
321
+ foreign import destroyWithError
322
+ :: forall r eff
323
+ . Stream r eff
324
+ -> Error
325
+ -> Eff eff Unit
You can’t perform that action at this time.
0 commit comments