mirror of
https://github.com/wader/fq.git
synced 2024-12-29 00:22:38 +03:00
44 lines
2.3 KiB
Plaintext
44 lines
2.3 KiB
Plaintext
/test.mp3:
|
|
$ fq -d mp3 '.headers[0].magic._bits[8:16] | hd' /test.mp3
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
|
0x0|44 |D |
|
|
$ fq -d mp3 '.headers[0].magic._bits | [.[8:16], .[0:8]] | hd' /test.mp3
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
|
0x0|44 49 |DI |
|
|
$ fq -d mp3 '.headers[0].magic._bits | [.[8:16], .[0:8]] | tobits | hd' /test.mp3
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
|
0x0|44 49 |DI |
|
|
$ fq -d mp3 '.headers[0].magic._bits | [.[8:16], .[0:8]] | tobytes | hd' /test.mp3
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
|
0x0|44 49 |DI |
|
|
$ fq -n '"12" | tobytes | hd'
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
|
0x0|31 32 |12 |
|
|
$ fq -n '"12" | tobits | hd'
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
|
0x0|31 32 |12 |
|
|
$ fq -n '["12", "3"] | tobytes | hd'
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
|
0x0|31 32 33 |123 |
|
|
$ fq -n '["12", "3"] | tobits | hd'
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
|
0x0|31 32 33 |123 |
|
|
$ fq -n '[("11" | hex), ("22" | hex)] | tobits | hd'
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
|
0x0|11 22 |." |
|
|
# TODO: bug, hexdump uses io.Copy which is byte oritneted
|
|
$ fq -n '[("12" | hex | .bits[4:]), ("34" | hex | .bits[0:4])] | tobits | hd'
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
|
0x0|23 |# |
|
|
$ fq -d mp3 '.frames[]._bits[0:12] | tonumber' /test.mp3
|
|
4095
|
|
4095
|
|
4095
|
|
$ fq -d mp3 '.headers[0].magic._bits[0:24] | tostring' /test.mp3
|
|
"ID3"
|
|
$ fq -d mp3 '.frames[0].padding | ("", "md5", "base64", "snippet") as $f | tovalue({bitsformat: $f})' /test.mp3
|
|
"<5>AAAAAAA="
|
|
"ca9c491ac66b2c62500882e93f3719a8"
|
|
"AAAAAAA="
|
|
"<5>AAAAAAA="
|