Is it possible to find out the length of an audio by requesting the Express?

Asked

Viewed 30 times

1

Hello, all right?

I am developing an application in Node.js with Express that has as one of its functions to receive an audio file and store the file information in the database. I am passing this file in format .ogg within the request, and in the body of the request I am passing the audio duration manually.

Is there any way to get audio duration from the request?

Follow an example of my role post()

route.post(
  '/upload',
  upload.single('audio'),
  (request, response) => {
    const { title, description, tags, duration, post_time } = request.body;
    const createAudioSevice = new CreateAudioService();

    const audio = createAudioSevice.execute({
      id: request.file.filename,
      title,
      user_id: request.user.id,
      description,
      duration,
      post_time,
      tags,
    });

    return response.json(audio);
  },
);
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.