-
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from visidata import vd, VisiData, JsonSheet | ||
|
||
|
||
@VisiData.api | ||
def open_msgpack(vd, p): | ||
return MsgpackSheet(p.name, source=p) | ||
|
||
|
||
VisiData.open_msgpackz = VisiData.open_msgpack | ||
|
||
|
||
class MsgpackSheet(JsonSheet): | ||
def iterload(self): | ||
msgpack = vd.importModule('msgpack') | ||
data = self.source.read_bytes() | ||
if self.source.suffix == '.msgpackz': | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
maxim-uvarov
Contributor
|
||
brotli = vd.importModule('brotli') | ||
data = brotli.decompress(data) | ||
yield from msgpack.unpackb(data, raw=False) |
This should actually check
self.options.filetype
instead of the source path suffix (so that it works from stdin also).