This is a stream mime detection example, creating streams of arbitrary sizes,
detecting the mime type of the stream, and then doing something based on the
detected type. It uses express
as a web app server implemented in index.js
and the axios
http client in client.js
.
Dealing with streams is a common usecase for mime type detection in Node. Dealing with file uploads (and validating the types of uploads) is another common task. This example is to demonstrate how to effectively do both.
Running this example requires building the parent project.
Install dependencies in this folder:
npm install
Run the server:
node index.js
While the server is running, run the client in another terminal:
node client.js