pcap-format provides an interface to encode and decode pcap files, dealing with both endianess, including endianess detection.
pcap-format can be installed with opam:
opam install pcap-format
If you don't use opam consult the pcap-format.opam file for build
instructions.
The documentation and API reference is automatically generated by
odoc from the interfaces. It can be consulted online.