score:2

Accepted answer

You need to get file from input for example you can fire handler on onChange event. After this you must put your file from input(e.target.file[0] or loop if files many) to FileReader and extract blob from file. Next you can send extracted blob through socket, if blob is too large you can slice it to chunks.

There is example of code:

const readBlob = file => new Promise((resolve, reject) => {
  const reader = new FileReader();

  reader.onload = e => {
    resolve(e.target.result);
  };

  reader.readAsText(file);
});

Sorry for my English!)


Related Query

More Query from same tag