Skip to content

Commit

Permalink
refactor: support download flac at app
Browse files Browse the repository at this point in the history
  • Loading branch information
little-buddy committed Dec 3, 2023
1 parent 5760f81 commit 772a46f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/electron/event/ipc-main/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,16 @@ const nodeDownload = async (
})
response.on('end', async () => {
const buffer = Buffer.concat(chunks)
const path = join(downloadPath, name + suffix)

let suffixName = ''

const urlSuffix = url.replace(/.+\./, '')
if (['.mp3', '.flac'].includes(urlSuffix)) {
suffixName = urlSuffix
} else {
suffixName = suffix
}
const path = join(downloadPath, name + suffixName)
const comm = Buffer.from(String(id)).toString('base64')
const { renderBuffer, addTag } = writeBufferID3(buffer)
addTag('TIT2', name)
Expand Down

0 comments on commit 772a46f

Please sign in to comment.