{"id":"nazumahk/byteflow","name":"byteflow","scope":"nazumahk","platform":"roblox","description":"ByteFlow for Roblox","version":"2.1.1","latest":"2.1.1","versions":["1.0.0","1.0.1","1.0.3","2.1.0","2.1.1"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"b2668d98475996c0eb0753dbeb05609db1fca1a1af542650e66626546d826256","likes":0,"downloads":0,"install":"forest install nazumahk/byteflow","url":"https://forest.dev/p/roblox/nazumahk/byteflow","files":"https://api.forest.dev/ai/package/roblox/nazumahk/byteflow/files","readme":"# ByteFlow\r\n\r\nA high-performance, buffer-based binary serialization networking engine for Roblox. ByteFlow v2.1.0 introduces industry-leading optimizations including Auto Bit-Packing and Transactional Writes.\r\n\r\n## Core Features\r\n\r\n- **Geometric Buffer Allocation**: Minimizes memory reallocations by doubling buffer capacity as needed.\r\n- **Auto Bit-Packing Engine**: Automatically compresses consecutive boolean fields within structs into single bits, reducing bandwidth usage for state flags by up to 800%.\r\n- **Transactional Consistency**: Packets are written atomically. If a serialization error occurs, the engine rolls back the buffer cursor to ensure subsequent packets remain intact.\r\n- **Dirty Flag Dispatch**: On the server, the Heartbeat loop only iterates over players who have pending data, moving dispatch complexity from $O(N_{players})$ to $O(N_{dirty})$.\r\n- **Advanced Observability**: Built-in support for real-time bandwidth monitoring and a robust incoming/outgoing middleware pipeline.\r\n- **DoS Protection**: Enforcement of payload size limits and instance reference counts to harden the server against malicious input.\r\n- **Deterministic Hashing**: Alphabetical namespace sorting and FNV-1a hashing ensure consistent packet IDs across the network barrier.\r\n\r\n## Installation\r\n\r\nAdd to your `wally.toml`:\r\n\r\n```toml\r\n[dependencies]\r\nByteFlow = \"nazumahk/byteflow@2.1.0\"\r\n```\r\n\r\n## Quick Start\r\n\r\n```luau\r\nlocal ByteFlow = require(Packages.ByteFlow)\r\nlocal t = ByteFlow.t\r\n\r\nlocal Net = ByteFlow.defineNamespace(\"Shared\", function()\r\n    return {\r\n        -- Automatically packed into 1 byte instead of 8 bytes\r\n        UpdateUI = ByteFlow.definePacket({\r\n            value = t.struct({\r\n                showLabels = t.bool,\r\n                showIcons = t.bool,\r\n                isInteractive = t.bool,\r\n                isAnimating = t.bool,\r\n                isVisible = t.bool,\r\n                isDisabled = t.bool,\r\n                isHovered = t.bool,\r\n                isSelected = t.bool,\r\n            }),\r\n            reliability = \"Reliable\"\r\n        })\r\n    }\r\nend)\r\n\r\n-- Transactional write\r\nNet.UpdateUI:send({\r\n    showLabels = true,\r\n    showIcons = true,\r\n    -- ... and so on\r\n})\r\n```\r\n\r\n## Advanced Usage\r\n\r\n### Bandwidth Monitoring\r\n```luau\r\nlocal stats = ByteFlow.bandwidth.stats\r\nprint(\"Outgoing bytes this second:\", stats.bytes_out)\r\n```\r\n\r\n### Middleware Pipeline\r\n```luau\r\nByteFlow.middleware.addIncoming(function(id, data, sender)\r\n    -- Filter or log incoming packets\r\n    return true -- Return false to drop the packet\r\nend)\r\n```\r\n\r\n## Documentation\r\n\r\n- [Technical Architecture](docs/Architecture.md) -- Buffer Management & Dispatch Logic\r\n- [API Specification](docs/API.md) -- Type & Method Reference\r\n\r\n## License\r\n\r\nMIT\r\n","readmeTruncated":false}