INNER CODE UNIT · JavaScript

transformIntoMP3

yenche123/liubai · liubai-backends/liubai-ffmpeg/app.js:48

function transformIntoMP3(id) {
  return new Promise((resolve, reject) => {
    const amrPath = getPath(id)
    const mp3Path = getPath(id, "mp3")
    ffmpeg(amrPath).on("end", () => {
      resolve()
    }).on("error", err => {
      reject(err)
    }).save(mp3Path)
  })
}

/************************* entry for transform AMR into MP3 ***************************/
app.get("/new", async (req, res) => {
  // 1. check out params
  const amrUrl = req.query.url
  const amrId = req.query.id
  if(!amrUrl || !amrId) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…