Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Archive
- **deb** - ``application/x-deb``
- **ar** - ``application/x-unix-archive``
- **Z** - ``application/x-compress``
- **lzo** - ``application/x-lzop``
- **lz** - ``application/x-lzip``

Font
Expand Down
1 change: 1 addition & 0 deletions filetype/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
archive.Deb(),
archive.Ar(),
archive.Z(),
archive.Lzop(),
archive.Lz(),
)

Expand Down
25 changes: 25 additions & 0 deletions filetype/types/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,31 @@ def match(self, buf):
buf[1] == 0x9D)))


class Lzop(Type):
"""
Implements the Lzop archive type matcher.
"""
MIME = 'application/x-lzop'
EXTENSION = 'lzo'

def __init__(self):
super(Lzop, self).__init__(
mime=Lzop.MIME,
extension=Lzop.EXTENSION
)

def match(self, buf):
return (len(buf) > 7 and
buf[0] == 0x89 and
buf[1] == 0x4C and
buf[2] == 0x5A and
buf[3] == 0x4F and
buf[4] == 0x00 and
buf[5] == 0x0D and
buf[6] == 0x0A and
buf[7] == 0x1A)


class Lz(Type):
"""
Implements the Lz archive type matcher.
Expand Down