Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getMetadata(buffer: Buffer): Buffer {
let offset = VERSION_SIZE;
const serviceLength = buffer.readUInt16BE(offset);
offset += SERVICE_LENGTH_SIZE + serviceLength;
const methodLength = buffer.readUInt16BE(offset);
offset += METHOD_LENGTH_SIZE + methodLength;
const tracingLength = buffer.readUInt16BE(offset);
offset += TRACING_LENGTH_SIZE + tracingLength;
return BufferEncoder.decode(buffer, offset, buffer.length);
}
export function getTracing(buffer: Buffer): Buffer {
let offset = VERSION_SIZE;
const serviceLength = buffer.readUInt16BE(offset);
offset += SERVICE_LENGTH_SIZE + serviceLength;
const methodLength = buffer.readUInt16BE(offset);
offset += METHOD_LENGTH_SIZE + methodLength;
const tracingLength = buffer.readUInt16BE(offset);
offset += TRACING_LENGTH_SIZE;
return BufferEncoder.decode(buffer, offset, offset + tracingLength);
}