File tree Expand file tree Collapse file tree 4 files changed +52
-0
lines changed Expand file tree Collapse file tree 4 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Type definitions for native-duplexpair 1.0
2
+ // Project: https://github.com/tediousjs/native-duplexpair#readme
3
+ // Definitions by: Tim Perry <https://github.com/pimterry>
4
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
+ /// <reference types="node" />
6
+
7
+ import { Duplex , DuplexOptions } from 'stream' ;
8
+
9
+ declare class DuplexPair {
10
+ readonly socket1 : Duplex ;
11
+ readonly socket2 : Duplex ;
12
+
13
+ constructor ( options ?: DuplexOptions ) ;
14
+ }
15
+
16
+ export = DuplexPair ;
Original file line number Diff line number Diff line change
1
+ // Taken straight from the package README:
2
+ import DuplexPair = require( 'native-duplexpair' ) ;
3
+
4
+ const { socket1, socket2 } = new DuplexPair ( ) ;
5
+
6
+ socket1 . write ( 'Hi' ) ;
7
+ console . log ( socket2 . read ( ) ) ; // => <Buffer 48 69>
8
+
9
+ const { socket1 : encodedSocket1 , socket2 : encodedSocket2 } = new DuplexPair ( { encoding : 'utf8' } ) ;
10
+
11
+ socket1 . write ( 'Hi' ) ;
12
+ console . log ( socket2 . read ( ) ) ; // => 'Hi'
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "module" : " commonjs" ,
4
+ "lib" : [
5
+ " es6"
6
+ ],
7
+ "noImplicitAny" : true ,
8
+ "noImplicitThis" : true ,
9
+ "strictFunctionTypes" : true ,
10
+ "strictNullChecks" : true ,
11
+ "baseUrl" : " ../" ,
12
+ "typeRoots" : [
13
+ " ../"
14
+ ],
15
+ "types" : [],
16
+ "noEmit" : true ,
17
+ "forceConsistentCasingInFileNames" : true
18
+ },
19
+ "files" : [
20
+ " index.d.ts" ,
21
+ " native-duplexpair-tests.ts"
22
+ ]
23
+ }
Original file line number Diff line number Diff line change
1
+ { "extends" : " @definitelytyped/dtslint/dt.json" }
You can’t perform that action at this time.
0 commit comments