Skip to content
jc-rs
GitHub

file

--filev1.5.0

Converts `file` command output to JSON

LinuxmacOSFreeBSDcommand
$ file | jc-rs --file

A real pair

From the reference corpus (ubuntu-18.04/file.json). The left pane is the input the fixture ships; the right pane is the corpus's expected JSON. CI compares jc-rs with it field by field under the published differential. Hover a value to see where it came from.

fileubuntu-18.04
crayaml.yaml:        ASCII text
git:                 directory
ifconfig-ubuntu.out: ASCII text
iptables-tests:      directory
lastb.out:           ASCII text
listjobs:            ASCII text
ls-lR.out:           ASCII text
ls-R.out:            ASCII text
netstat-ae.out:      ASCII text
netstat-aew.out:     ASCII text
netstat-a.out:       ASCII text
netstat-aw.out:      ASCII text
resizeterm.sh:       Bourne-Again shell script, ASCII text executable
snap:                directory
ssout:               ASCII text
sudofix:             ASCII text
testfiles:           directory
tmp:                 directory
trafficgen.sh:       Bourne-Again shell script, ASCII text executable
xmltest.xml:         XML 1.0 document, ASCII text
expected outputjson
Use the Left and Right arrow keys to highlight the matching value in the input.
[
  {
    "filename": "crayaml.yaml",
    "type": "ASCII text"
  },
  {
    "filename": "git",
    "type": "directory"
  },
  {
    "filename": "ifconfig-ubuntu.out",
    "type": "ASCII text"
  },
  {
    "filename": "iptables-tests",
    "type": "directory"
  },
  {
    "filename": "lastb.out",
    "type": "ASCII text"
  },
  {
    "filename": "listjobs",
    "type": "ASCII text"
  },
  {
    "filename": "ls-lR.out",
    "type": "ASCII text"
  },
  {
    "filename": "ls-R.out",
    "type": "ASCII text"
  },
  {
    "filename": "netstat-ae.out",
    "type": "ASCII text"
  },
  {
    "filename": "netstat-aew.out",
    "type": "ASCII text"
  },
  {
    "filename": "netstat-a.out",
    "type": "ASCII text"
  },
  {
    "filename": "netstat-aw.out",
    "type": "ASCII text"
  },
  {
    "filename": "resizeterm.sh",
    "type": "Bourne-Again shell script, ASCII text executable"
  },
  {
    "filename": "snap",
    "type": "directory"
  },
  {
    "filename": "ssout",
    "type": "ASCII text"
  },
  {
    "filename": "sudofix",
    "type": "ASCII text"
  },
  {
    "filename": "testfiles",
    "type": "directory"
  },
  {
    "filename": "tmp",
    "type": "directory"
  },
  {
    "filename": "trafficgen.sh",
    "type": "Bourne-Again shell script, ASCII text executable"
  },
  {
    "filename": "xmltest.xml",
    "type": "XML 1.0 document, ASCII text"
  }
]

Fixture coverage

3/3oracle-valid pairs match under the published structural JSON comparison

Magic syntax

jc-rs filejc-rs runs the command itself and parses what it prints. Recognised for: `file`

Source: crates/jc-rs-parsers/src/system/file.rs. jc-rs targets the schemas defined by the original Python tool. Fixture coverage above is the measured evidence for this parser; test the inputs your pipeline depends on. Compare