mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-19 01:03:58 +00:00
chore: apply code fixes with biome
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
import * as BSON from 'bson'
|
||||
import { Packet, PacketSchema } from '../schemas/index.js'
|
||||
import { Operation } from '../constants/index.js'
|
||||
import { parse } from 'valibot'
|
||||
|
||||
/**
|
||||
* Compresses a packet into a buffer
|
||||
* @param packet The packet to compress
|
||||
* @returns A buffer of the compressed packet
|
||||
*/
|
||||
export function serializePacket<TOp extends Operation>(packet: Packet<TOp>) {
|
||||
return BSON.serialize(packet)
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompresses a buffer into a packet
|
||||
* @param buffer The buffer to decompress
|
||||
* @returns A packet
|
||||
*/
|
||||
export function deserializePacket(buffer: Buffer) {
|
||||
const data = BSON.deserialize(buffer)
|
||||
return parse(PacketSchema, data) as Packet
|
||||
}
|
||||
import * as BSON from 'bson'
|
||||
import { parse } from 'valibot'
|
||||
import { Operation } from '../constants/index.js'
|
||||
import { Packet, PacketSchema } from '../schemas/index.js'
|
||||
|
||||
/**
|
||||
* Compresses a packet into a buffer
|
||||
* @param packet The packet to compress
|
||||
* @returns A buffer of the compressed packet
|
||||
*/
|
||||
export function serializePacket<TOp extends Operation>(packet: Packet<TOp>) {
|
||||
return BSON.serialize(packet)
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompresses a buffer into a packet
|
||||
* @param buffer The buffer to decompress
|
||||
* @returns A packet
|
||||
*/
|
||||
export function deserializePacket(buffer: Buffer) {
|
||||
const data = BSON.deserialize(buffer)
|
||||
return parse(PacketSchema, data) as Packet
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user