I
I
idclev312015-05-21 02:16:25
JavaScript
idclev31, 2015-05-21 02:16:25

How to determine the file type on the server when transferring it with socket.io?

I transfer the file to the server using socket.io.
Determining the format on the client side is not a problem, however, a bunch of bits come to the server, and it is not clear how to determine which format with their help.
Send like thissocket.emit('send-file', file.name, buffer);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2015-05-21
@idclev31

Option two:

  • Determine the mime type on the server side directly from the data by the "magic" header, https://github.com/mscdex/mmmagic
  • Didn't find what you were looking for?

    Ask your question

    Ask a Question

    731 491 924 answers to any question