Skip to main content
This codemod replaces zlib.bytesRead with zlib.bytesWritten for consistent stream property naming to handle Node.js DEP0108.

What It Does

This codemod:
  • Replaces bytesRead property with bytesWritten in all zlib transform streams
  • Handles both CommonJS and ESM imports
  • Works with all zlib stream types (Gzip, Deflate, Inflate, etc.)

Before/After Examples

Basic Usage with Gzip

Before:
After:

Statistics Object

Before:
After:

Progress Tracking

Before:
After:

ESM Import

Before:
After:

Destructured Require

Before:
After:

Usage

Run this codemod on your project:
The property name change from bytesRead to bytesWritten may seem counterintuitive, but it aligns with the stream’s perspective: bytes written to the compression/decompression stream.
This codemod works with all zlib compression streams including createGzip(), createGunzip(), createDeflate(), createInflate(), createDeflateRaw(), createInflateRaw(), createUnzip(), and createBrotliCompress()/createBrotliDecompress().