streamich/memfs

Cannot set property closed of #<Readable> which has only a getter in NodeJS v18.0.0

Closed this issue ยท 5 comments

NodeJS v18.0.0

TypeError: Cannot set property closed of #<Readable> which has only a getter
    at FsReadStream.close (d:\0\node_modules\memfs\lib\volume.js:2047:17)
    at FsReadStream._destroy (d:\0\node_modules\memfs\lib\volume.js:2032:10)
    at _destroy (node:internal/streams/destroy:109:10)
    at class_1.destroy (node:internal/streams/destroy:71:5)
    at class_1.<anonymous> (d:\0\node_modules\memfs\lib\volume.js:1962:22)
    at class_1.emit (node:events:539:35)
    at class_1.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1344:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

caused by this.closed = true in node_modules/memfs/lib/volume.js

FsReadStream.prototype.close = function (cb) {
    var _this = this;
    if (cb)
        this.once('close', cb);
    if (this.closed || typeof this.fd !== 'number') {
        if (typeof this.fd !== 'number') {
            this.once('open', closeOnOpen);
            return;
        }
        return process_1.default.nextTick(function () { return _this.emit('close'); });
    }
    this.closed = true;
    this._vol.close(this.fd, function (er) {
        if (er)
            _this.emit('error', er);
        else
            _this.emit('close');
    });
    this.fd = null;
};

Same bugs
Suggestion

Pull requests are welcomed ๐Ÿ™‚

@G-Rath I put up a PR to fix this - #836 I'm not sure what are the contribution guidelines, but I saw you already contributed to the repo, so I'm just letting you know.

Awesome thanks - I've got merge powers so will take a look tomorrow morning.

๐ŸŽ‰ This issue has been resolved in version 3.4.2 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€