Skip to content

Commit

Permalink
Use TextDecoder instead of Buffer.toString
Browse files Browse the repository at this point in the history
  • Loading branch information
tamuratak committed Oct 17, 2024
1 parent 13a6a8c commit 46614c0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/utils/utf8.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const decoder = new TextDecoder()
const encoder = new TextEncoder()

export function decodeUtf8(bytes: Uint8Array) {
return decoder.decode(bytes)
}

export function encodeUtf8(str: string) {
return encoder.encode(str)
}

0 comments on commit 46614c0

Please sign in to comment.