metarhia/metacom

Stream does not end

Closed this issue · 2 comments

Describe the bug

During file transfer, the stream never ends due to an error in the library.

Arguments are passed incorrectly to the constructor on line 299

Passed:

const stream = new MetaReadable({ id, name, size });

Expected:

class MetaReadable extends EventEmitter {
  constructor(id, name, size, options = {})

To Reproduce

({
  access: 'public',

  method: async ({ streamId }) => {
    const readable = context.client.getStream(streamId);

    const getChunks = async () => {
      console.log('start');
      const chunks = [];
      for await (const chunk of readable) {
        chunks.push(chunk);
      }
      console.log('end');
    };

    getChunks();

    return { result: 'Stream initialized' };
  },
});

Expected behavior

The stream should end.

Screenshots

No response

Desktop (please complete the following information):

  • OS: Windows 10
  • Node.js version 20.11.1

Additional context

No response

Please try to use streams