mirror of
https://github.com/jwetzell/psn-js.git
synced 2026-09-01 20:39:25 +00:00
reuse instances of TextDecoder/Encoder
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { Decoders } from '..';
|
||||
import { InfoTrackerNameChunk, InfoTrackerNameChunkData } from '../../models/info/info-tracker-name-chunk';
|
||||
|
||||
const nameDecoder = new TextDecoder();
|
||||
export default (buffer: Uint8Array): InfoTrackerNameChunk => {
|
||||
const chunk = Decoders.Chunk(buffer);
|
||||
|
||||
const data: InfoTrackerNameChunkData = {
|
||||
trackerName: new TextDecoder().decode(chunk.chunkData.subarray(0, chunk.header.dataLen)),
|
||||
trackerName: nameDecoder.decode(chunk.chunkData.subarray(0, chunk.header.dataLen)),
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user