NodeSchool Challenge, How does the Duplexer package works?

I would like to know how to implement this Nodeschool challenge without the use of duplexer package in NodeJS?

I'm not able to understand how the Duplexer NodeJS Package works. All I understand, is that it takes a writeable stream, a readable stream, then joins them together to be a one writeable/readable stream.

How to implement this (NodeSchool Challenge) without the duplexer? and how does the stream CountryStream has a function?

const duplexer = require("duplexer"),
through = require("through"),

var count = {};

module.exports = function (countryStream) {
    var writeableStream = through(writeEachChunk, endWriting);
    return duplexer(writeableStream, countryStream); //(writeable, readable) => readable/writeable stream

    function writeEachChunk (line) {
        if (count[line.country] == null) {
            count[line.country] = 1;
        }else{
            count[line.country] = count[line.country]+1; // Why objects cant increment? count[line.country]++
        }
    } // No semicolon
    function endWriting () {
        countryStream.setCounts(count);
    }
};