skip to Main Content

In Node.js How do I get audio duration for an audio file in google cloud storage without downloading ?

2

Answers


  1. Looking at the documentation I can’t see anything for examining the content of files, let along anything as specific as calculating the duration of an audio file, so: You can’t.

    At a bare minimum (depending on the file format) you’d need to download enough of the file to read its embedded meta data (I can’t see any mention of support for content-range though so you might have to get the entire file.)

    Login or Signup to reply.
  2. Google Cloud Storage just stores the raw bytes of any files or objects you upload. It makes no attempt to understand that format or meaning of the data you’re putting in them. So you won’t be able to ask it to understand things such as the duration or other properties of the audio (or any other type of content).

    If you want information about some content readily available without downloading the contents of the object, you could instead use custom metadata to store the specific data you need quick access to. Then you can just request the metadata alone without downloading the content. It’s up to you to determine what to store and how to compute it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search