convert to typescript

This commit is contained in:
2023-09-14 22:43:25 -05:00
parent 4c19f5f7b9
commit f21bef263d
64 changed files with 1109 additions and 605 deletions
@@ -0,0 +1,11 @@
import chunk, { Chunk } from '../chunk';
export interface InfoTrackerNameChunk extends Chunk {
tracker_name: string;
}
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;