Writing a simple class example;

  
    class CustomEmitter extends EventEmitter {
      constructor() {
        super();
      }
      write(data) {
        this.emit('data', data)
      }
    }

    const stream = new CustomEmitter();