lib/writable.js
function WriteStream(opts) {
    assert.object(opts);
    if (opts.encoding !== null)
        assert.string(opts.encoding, 'options.encoding');
    assert.string(opts.flags, 'options.flags');
    assert.number(opts.mode, 'options.mode');
    assert.object(opts.fs, 'options.fs');
    assert.optionalNumber(opts.start, 'options.start');

    stream.Writable.call(this, opts);

    this.bytesWritten = 0;
    this.encoding = opts.encoding;
    this.flags = opts.flags;
    this.mode = opts.mode;
    this.start = opts.start || 0;

    this._fd = opts.fd;
    this._fs = opts.fs;

    this._opening = true;
    this._pos = this.start;

    var self = this;
    this.once('finish', function onFinsh() {
        if (!self._fd)
            return;

        self._fs.close(self._fd, function onClose(err) {
            if (err) {
                self.emit('error', err);
            } else {
                self.emit('close');
            }
        });
    });
}
function WriteStream(opts) {
    assert.object(opts);
    if (opts.encoding !== null)
        assert.string(opts.encoding, 'options.encoding');
    assert.string(opts.flags, 'options.flags');
    assert.number(opts.mode, 'options.mode');
    assert.object(opts.fs, 'options.fs');
    assert.optionalNumber(opts.start, 'options.start');

    stream.Writable.call(this, opts);

    this.bytesWritten = 0;
    this.encoding = opts.encoding;
    this.flags = opts.flags;
    this.mode = opts.mode;
    this.start = opts.start || 0;

    this._fd = opts.fd;
    this._fs = opts.fs;

    this._opening = true;
    this._pos = this.start;

    var self = this;
    this.once('finish', function onFinsh() {
        if (!self._fd)
            return;

        self._fs.close(self._fd, function onClose(err) {
            if (err) {
                self.emit('error', err);
            } else {
                self.emit('close');
            }
        });
    });
}
/--- Streams