S
S
Shakir Darion2020-01-22 02:50:18
Node.js
Shakir Darion, 2020-01-22 02:50:18

Why is the first element of createWriteStream not added?

I want to add files to server like this

uploadFiles: async (_, { files }) => {
      const x = await Promise.all(files);
      for (const [key, value] of x.entries()) {
        const { createReadStream, filename } = value;
        brduj.push(filename);
        createReadStream().pipe(
          createWriteStream(path.join(__dirname, "../images", filename))
        );
      }
    }

but always the first element is not added. I do not understand why. How can this be fixed?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question