Skip to content

Commit

Permalink
fix: return Buffer for Node apps #611
Browse files Browse the repository at this point in the history
  • Loading branch information
eidoriantan committed Aug 29, 2023
1 parent 89106c4 commit 467532f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mp3tag.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default class MP3Tag {
audio = mergeBytes(tagBytes, audio)
}

return audio.buffer
return typeof Buffer !== 'undefined' ? Buffer.from(audio.buffer) : audio.buffer
}

save (options = {}) {
Expand Down Expand Up @@ -228,7 +228,8 @@ export default class MP3Tag {
} else i++
}

return buffer.slice(start)
const sliced = buffer.slice(start)
return typeof Buffer !== 'undefined' ? Buffer.from(sliced) : sliced
}

getAudio () { return MP3Tag.getAudioBuffer(this.buffer) }
Expand Down

0 comments on commit 467532f

Please sign in to comment.