mirror of
https://github.com/jwetzell/psn-js.git
synced 2026-08-18 13:44:20 +00:00
22 lines
476 B
TypeScript
22 lines
476 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,
|
|
};
|
|
};
|