Developer builds browser tool to generate valid files at any exact byte size
A developer needed a precisely sized 10 MB PDF for upload-limit testing and found that existing tools only offered fixed sizes or server-side downloads. The solution involved generating files entirely in the browser by embedding padding inside format-legal locations, such as PNG metadata chunks, PDF content streams, or ZIP archive entries, rather than appending raw bytes that would corrupt the file. Each format reserves specific areas where extra data is ignored by decoders, and formats like PNG require a correct CRC-32 checksum for the padding chunk to be accepted. Because all processing happens locally in memory, even a 100 MB file can be assembled in milliseconds with no data leaving the user's machine. The developer packaged the technique into a free browser-based tool called ByteRivet, supporting 19 file formats at any user-specified exact size.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in