npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tnz3270-node

v0.2.0

Published

TypeScript library for IBM mainframe TN3270 terminal automation

Downloads

303

Readme

TNZ-Node

TNZ-Node is a zero-dependency, highly performant TypeScript library. It provides a complete TN3270 data stream parser, protocol negotiator, and screen buffer manager for interacting with IBM Mainframes (z/OS, MVS, TK4-).

It includes a powerful automation layer (Ati) for headless scripting, screen scraping, and concurrent mainframe interactions, as well as native support for IND$FILE (DDM) file transfers.

Features

  • Full 3270 Protocol Implementation: Complete support for Write, Erase/Write, Read Buffer, Read Modified, and WSF operations.
  • Native Keyboard Emulation: Maps complex 3270 keys ([enter], [pf1], [tab], [clear]) directly to buffer operations handling MDT and protection boundaries.
  • Enhanced Screen Reading: scrstr() and scrhas() implementations with full character-set awareness (EBCDIC/ASCII/GE), control character translation, and password field cloaking.
  • ATI Automation Engine: A robust, event-driven scripting layer allowing you to safely type, wait for screen conditions, and trigger conditional actions (when).
  • Concurrent Execution: The socket logic is entirely event-driven, allowing you to spawn hundreds of mainframe bots simultaneously without blocking the Node.js event loop.
  • File Transfers: Natively implements the DDM IND$FILE protocol, allowing file uploads and downloads between your local machine and the host.
  • Zero Runtime Dependencies: The entire library is built strictly on Node.js built-ins (net, tls, events).

Installation

npm install tnz3270-node
# or
yarn add tnz3270-node
# or
bun install tnz3270-node

Quick Start

The easiest way to interact with the mainframe programmatically is through the Ati automation wrapper.

import { Ati } from 'tnz3270-node';

async function main() {
  const ati = new Ati();

  console.log('Connecting...');
  await ati.connectSession('MVS_SESSION', {
    host: '127.0.0.1',
    port: 3270,
    useTn3270e: true,
  });

  // Wait for the Logon prompt to appear on the screen
  await ati.wait(10, () => ati.scrhas('Logon ===>'));

  // Clear the screen and type the TSO logon command
  await ati.send('[clear]');
  await ati.wait(2, () => ati.keyLock === false);
  await ati.send('L HERC01[enter]');

  // Wait for the password prompt
  await ati.wait(10, () => ati.scrhas('PASSWORD'));

  // Enter the password
  await ati.send('CUL8TR[enter]');

  // Wait for TSO READY
  await ati.wait(10, () => ati.scrhas('READY'));

  // Print the screen buffer to the console
  const tnz = ati.getTnz();
  console.log(tnz.scrstr(0, 0, true));

  console.log('Logged in successfully!');
  ati.dropSession();
}

main().catch(console.error);

IND$FILE File Transfers

// Download a remote dataset to your local machine
await ati.getFile('sys1.proclib(test) ascii crlf', './local-file.txt');

// Upload a local file to the mainframe
await ati.putFile('./local-file.txt', 'herc01.my.dataset ascii crlf');

Development & Testing

# Start development mode
bun run dev

# Build for production
bun run build

# Run unit tests (289 tests covering 3270 binary protocols)
bun run test

# Run automation integration test against a local TK4- instance
bun run test-login.ts
bun run test-stress.ts
bun run test-concurrency.ts

License

MIT