generated from jsynowiec/node-typescript-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat #4: TCP sockets support added * feat #4: Error handling for socket path * fix #7: Import destructuring and minor fixes * fix #7: fs renamed to fsPromises * Update github repo link * fix: Don't fail build if just version check fails if not publishing release * 0.1.0 beta test release (#11) * fix: Correct downloaded atrifact name * Test staging release * Update build.yml * fix: Bump version in package.json on staging * fix: bump version * fix: rename tar file * fix: Rename tar only if doesn't exist * fix * Removed unnecessarry await * fix: Support passing data along with hook Closes #16 Co-authored-by: Saurav M. H <[email protected]> Co-authored-by: Rakshith Ravi <[email protected]>
- Loading branch information
1 parent
fb81e9b
commit 22f8272
Showing
8 changed files
with
129 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "juno-node", | ||
"version": "0.0.3", | ||
"version": "0.1.1", | ||
"description": "", | ||
"keywords": [], | ||
"main": "dist/juno-node.cjs.js", | ||
|
@@ -12,7 +12,7 @@ | |
"author": "thebongy <[email protected]>", | ||
"repository": { | ||
"type": "git", | ||
"url": "" | ||
"url": "https://github.com/bytesonus/juno-node" | ||
}, | ||
"license": "MIT", | ||
"engines": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Socket, createConnection } from 'net'; | ||
import BaseConnection from './base-connection'; | ||
|
||
export default class InetSocketConnection extends BaseConnection { | ||
client?: Socket; | ||
host: string; | ||
port: number; | ||
|
||
constructor(host: string, port: number) { | ||
super(); | ||
this.host = host; | ||
this.port = port; | ||
} | ||
|
||
setupConnection(): Promise<void> { | ||
return new Promise(resolve => { | ||
this.client = createConnection(this.port, this.host); | ||
this.client.on('data', (data) => { | ||
const dataLines = data.toString().split(/\r?\n/); | ||
dataLines.map((data) => { | ||
if (data) { | ||
this.onData(Buffer.from(data)) | ||
} | ||
}); | ||
}); | ||
this.client.on('connect', () => { | ||
resolve(); | ||
}); | ||
}); | ||
} | ||
|
||
async closeConnection() { | ||
this.client?.destroy(); | ||
} | ||
|
||
send(message: Buffer): Promise<void> { | ||
return new Promise(resolve => { | ||
this.client?.write(message, () => { | ||
resolve(); | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters