
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
tn3270 is a pure TypeScript implementation of the Telnet protocol necessary to negotiate a connection from a software 3270 emulator and a host that accepts 3270 connections.
I use tn3270 as the basis for my own 3270 emulator EL-3270. I factored out the connection code to better expose it for others to use in their own emulators. I hope that it also exposes the protocol in an easy to understand way.
These two documents explain the protocol exhaustively.
I also found this summary of Telnet commands by Dave Marshall very helpful.
npm install --save tn3270
tn3270 negotiates a session with the host and if successful returns an Observable stream of data from the host to the emulator. A write API supports data transfer from the emulator back to the host.
All the other complex details of the 3270 data stream are delegated to the emulator, of which EL-3270 is a good example.
Because the API surface is so small, I've reproduced it here in full.
import { Observable } from 'rxjs/Observable';
export declare class Tn3270 {
host: string;
port: number;
model: string;
stream$: Observable<Buffer>;
constructor(host: string, port: number, model: string);
write(bytes: any): void;
}
writeaccepts either an array of bytes or a Node.jsBuffer.
Here's how I use tn3270 in my Electron 3270 emulator.
import { Tn3270 } from 'tn3270';
ipcMain.on('connect', (event: any,
host: string,
port: number,
model: string) => {
theTn3270 = new Tn3270(host, port, model);
theConnection = theTn3270.stream$.subscribe({
next: (data: Buffer) => {
const view = new Uint8Array(data.length);
for (let i = 0; i < data.length; i++)
view[i] = data[i];
theWindow.webContents.send('data', view);
},
error: (error: Error) => theWindow.webContents.send('error', error.message),
complete: () => theWindow.webContents.send('disconnected')
});
});
Many thanks to Ricardo Bánffy for his 3270 Font, republished here for convenience. I actually grabbed the TTF versions from the S3 bucket https://s3.amazonaws.com/3270font/3270_fonts_4cfe95c.zip that Ricardo references.
The 3270 font can be included in your app simply via the fonts/3270.css file. Here's how I use it in my Angular CLI projects, just like any other font in angular.json.
"styles": [
"node_modules/roboto-fontface/css/roboto/roboto-fontface.css",
"node_modules/tn3270/fonts/3270.css"
],
FAQs
Pure TypeScript 3270 emulation via Telnet for Node.js
We found that tn3270 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.