mirror of
https://github.com/jwetzell/psn-js.git
synced 2026-09-01 04:19:19 +00:00
17 lines
477 B
TypeScript
17 lines
477 B
TypeScript
import type { InfoTrackerNameChunk, InfoTrackerNameChunkData } from '../../models/info/info-tracker-name-chunk.js';
|
|
import { Decoders } from '../index.js';
|
|
|
|
const nameDecoder = new TextDecoder();
|
|
export default (buffer: Uint8Array): InfoTrackerNameChunk => {
|
|
const chunk = Decoders.Chunk(buffer);
|
|
|
|
const data: InfoTrackerNameChunkData = {
|
|
trackerName: nameDecoder.decode(chunk.chunkData.subarray(0, chunk.header.dataLen)),
|
|
};
|
|
|
|
return {
|
|
chunk,
|
|
data,
|
|
};
|
|
};
|