Skip to content

Populate gzip context #51

@effigies

Description

@effigies

If a file suffix is .gz, it should populate a gzip context.

The object needs to follow the protocol bidsschematools.types.protocols.Gzip, possibly just using bidsschematools.types.context.Gzip.

The Python stdlib does not provide access to the fields we look for, so it is probably simplest to follow the lead of the typescript validator: https://github.com/bids-standard/bids-validator/blob/cf494fd/src/files/gzip.ts

def read_gzip_header(file: FileTree) -> bst.types.context.Gzip:
    with open(file, 'rb') as fobj:
        buffer = fobj.read(512)
    ...
    return Gzip(timestamp, filename, comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions