streamich/memfs

Using createWriteStream does not work as intended

Open

#900 opened on Mar 28, 2023

 (3 comments) (3 reactions) (0 assignees)TypeScript (147 forks)github user discovery
buggood first issuehelp wanted

Repository metrics

Stars
 (2,062 stars)
PR merge metrics
 (Avg merge 4d 8h) (8 merged PRs in 30d)

Description

I am downloading a file from google drive, which works perfectly with node fs module with this code

const drive = google.drive({ version: "v3", auth }); const dest = fs.createWriteStream("./downloaded.zip");

drive.files.get(
    { fileId: "google-file-id", alt: "media" },
    { responseType: "stream" },
    (err, res) => {
        res?.data.pipe(dest);
    }
);

but when using memfs I am receiving this error

"Error: ENOENT: no such file or directory, open '/home/yory/casino-odr-v2/services/casino-odr-v2/downloaded.zip'\n at createError (/home/yory/casino-odr-v2/node_modules/.pnpm/memfs@3.4.13/node_modules/memfs/lib/volume.js:128:17)\n at Volume.openFile (/home/yory/casino-odr-v2/node_modules/.pnpm/memfs@3.4.13/node_modules/memfs/lib/volume.js:850:23)\n at Volume.openBase (/home/yory/casino-odr-v2/node_modules/.pnpm/memfs@3.4.13/node_modules/memfs/lib/volume.js:861:25)\n at Immediate. (/home/yory/casino-odr-v2/node_modules/.pnpm/memfs@3.4.13/node_modules/memfs/lib/volume.js:698:33)\n at processImmediate (node:internal/timers:471:21)\n at process.callbackTrampoline (node:internal/async_hooks:130:17)"

Contributor guide