Skip to content

Report the offset at which "Unexpected EOF" error occured #221

Open
@LorisSigrist

Description

@LorisSigrist

What can't you do right now?
I'm trying to process a buffer with sections that are compressed with deflate. I know where these sections start, but have no idea how long they are. I need to skip past these sections so I can continue processing the buffer.

If there were a way to know at which offset EOF happened I would be able to skip past these sections.

Example Buffer:

| plaintext data I want to read | deflated data of unknown length | plaintext data I want to read  | 

An optimal solution
Two possibilities:

  • The "Unexpected EOF" error reports the offset at which the file ended.
  • The inflate command succeeds with the decompressed data and tells you how many bytes remained unprocessed in the input.

How is this done by other libraries?
pako (which I'm currently using) doesn't fail when hitting the EOF. Instead it emits the decompressed data & has a value you can read the tells you how many bytes have remained unprocessed.

Eg. If you have a 150byte buffer and the first 100 are deflated-data, it will emit the decompressed data & tell you there are 50 bytes remaining.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions