mirror of
https://github.com/jwetzell/psn-js.git
synced 2026-09-11 00:59:41 +00:00
organize models and new modules
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import chunk, { Chunk } from '../chunk';
|
||||
export interface InfoTrackerNameChunk extends Chunk {
|
||||
tracker_name: string;
|
||||
}
|
||||
import { Decoders } from '..';
|
||||
import { InfoTrackerNameChunk } from '../../models/info/info-tracker-name-chunk';
|
||||
|
||||
function decodeTrackerNameChunk(trackerNameChunk: InfoTrackerNameChunk) {
|
||||
if (trackerNameChunk.chunk_data !== undefined && trackerNameChunk.data_len !== undefined) {
|
||||
trackerNameChunk.tracker_name = trackerNameChunk.chunk_data.subarray(0, trackerNameChunk.data_len).toString();
|
||||
}
|
||||
}
|
||||
export default (buffer: Buffer): InfoTrackerNameChunk => chunk(buffer, decodeTrackerNameChunk) as InfoTrackerNameChunk;
|
||||
export default (buffer: Buffer): InfoTrackerNameChunk =>
|
||||
Decoders.Chunk(buffer, decodeTrackerNameChunk) as InfoTrackerNameChunk;
|
||||
|
||||
Reference in New Issue
Block a user