Skip to content

Reading Archive from bytes in memory #40

@rpm5099

Description

@rpm5099

I would like to be able to read archives from memory, however the Archive class doesn't allow that. If you try to pass it using BytesIO it fails because it has a non-functional fileno property (there's no actual file descriptor open). libarchive has a function that seems to support this in archive_read_open_memory(arg1, buff, size) but I cannot seem to convert a python bytes object to the correct type required by that function using ctypes. Everything I've tried ends up with the error:

TypeError: in method 'archive_read_open_memory', argument 2 of type 'void const *'

Could you show the correct way to pass python bytes to that function argument buff? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions