memfs icon indicating copy to clipboard operation
memfs copied to clipboard

Using createReadStream fails

Open sbreiler opened this issue 6 years ago • 1 comments

I'm trying to get a ftp server running with memfs (using: https://github.com/nodeftpd/nodeftpd).

nodeftpd at some point tries to read from fs: var rs = self.fs.createReadStream(null, {fd: fd}); which fails by memfs with:

TypeError: path must be a string or Buffer at pathToFilename (C:\projects\ftpproxy\node_modules\memfs\lib\volume.js:292:19) at class_1.FsReadStream (C:\projects\ftpproxy\node_modules\memfs\lib\volume.js:1844:17) at new class_1 (C:\projects\ftpproxy\node_modules\memfs\lib\volume.js:462:31) at Volume.createReadStream (C:\projects\ftpproxy\node_modules\memfs\lib\volume.js:1739:16) ...

Any suggestions on how to solve this? I think the null-Argument at createReadStream freaks memfs out :-D

sbreiler avatar Dec 04 '18 13:12 sbreiler

It must be this line:

  • https://github.com/streamich/memfs/blob/master/src/volume.ts#L2180
    • https://github.com/streamich/memfs/blob/master/src/volume.ts#L392

And the current implementation in Node is like this:

  • https://github.com/nodejs/node/blob/master/lib/internal/fs/streams.js#L55
    • https://github.com/nodejs/node/blob/master/lib/internal/url.js#L1365
      • https://github.com/nodejs/node/blob/master/lib/internal/url.js#L1331

streamich avatar Dec 04 '18 19:12 streamich