| Crates.io | jfsm |
| lib.rs | jfsm |
| version | 0.1.5 |
| created_at | 2025-10-13 13:15:28.082618+00 |
| updated_at | 2025-10-13 14:05:13.339293+00 |
| description | A command-line tool to read file system metadata then return it in JSON format (output and errors). |
| homepage | |
| repository | https://github.com/fruafr/rust-jfsm |
| max_upload_size | |
| id | 1880510 |
| size | 62,053 |
A command-line tool to read file system metadata then return it in JSON format (output and errors).
jfsm <filepath>
--id: allows you to provide a custom request ID for tracing requests
-a|--all: provides detailed information
-d|--path: adds dirn, basen, relp, reldirp, ext, fnnoext, shortp, filet,sizeh.
-p|--perms: adds user, group, perms, ownerp, groupp, othersp, isfile, issyml, isdir, isexec.
-t|--time: adds atimeiso, mtimeiso and ctimeiso information.
The tool returns a JSON object with the following fields:
request: the request objectresponse: the response objecterror: the error objectrequest always is present.
response and error are mutually exclusive.
method: the name of this tool. 'jfsm'version: the version of this toolts: timestamp in nanoseconds when the request was receivedparams : contains the parameters as "key":value
filepath: filepath you provided in your requestall, time, path, perms: true or falseid: value provided with --id, else nullraw: contains the raw metadatapath: contains detailed path informationperms: contains detailed permissions informationtime: contains detailed time informationts: timestamp in nanoseconds when the request was respondedContained in response.raw:
Follows Linux Man page
pathname (pathname): File path name - normalized absolutized version of the pathname path (includes filename and extension for files)dev (st_dev): ID of device containing fileinode (st_ino): inode number - index (number)nlink (st_nlink): Link count (number)size (st_size): Total size, in bytes (number)blksize (st_blksize): Preferred I/O block size - blocksize for file system I/O (number)blocks (st_blocks): Blocks allocated - number of 512B blocks allocatedrdev (st_rdev): device ID (if special file)ftvalue: File type valuemode (st_mode): the perms in octet representation. e.g. 777uid (st_uid): the user id (number)gid (sb.st_gid): the group id (number)atime (st_atime): Last file access - last access time in seconds since epoch (UTC)mtime (st_mtime): Last file modification - the last modification time in seconds since epoch (UTC)ctime (st_ctime): Last status change - Creation time in seconds since epoch (UTC)atimensec: the last access time in nanoseconds since atimemtimensec: the last modification time in nanoseconds since mtimectimensec: the creation time in nanoseconds since ctimeContained in response.path:
dirn: directory name of pathname path (absolute path without filename).basen: file name with extensionrelp: relative path to the filepath where the tool is used fromreldirp: relative path to the directory where the tool is used fromext: file extensionfnnoext: file name without the extensionshortp: Short path relative to parent director. dir/basenamefilet: Human readable version of the filetypesizeh : Total size, in human format (text)Contained in response.perms:
user: user namegroup: group nameperms: perms in human readable format. e.g. drwxr-xr-xownerp: owner permissions in human readable format. e.g rwxgroupp: group permissions in human readable format. e.g r-xothersp: others permissions in human readable format. e.g r-xisfile: boolean indicating if the filepath is a file. True if file.issyml: boolean indicating if the filepath is a symlink. True if symlink.isdir: boolean indicating if the filepath is a directory. True if dir.isexec: boolean indicating if the file is executable by the user. True if executable.Contained in response.time:
atimeiso: the last access time in text ISO 8601 format (UTC)mtimeiso: the last modification time in text ISO 8601 format (UTC)ctimeiso: the creation time in text ISO 8601 format (UTC)| Value (ftvalue) | File type (filet) |
|---|---|
| S_IFBLK | block device |
| S_IFCHR | character device |
| S_IFDIR | directory |
| S_IFIFO | FIFO/pipe |
| S_IFLNK | symlink |
| S_IFREG | regular file |
| S_IFSOCK | socket |
jfsm test.txt
Returns:
{
"request": {
"method": "jfsm",
"params": {
"filepath": "/tmp/temporary-test-jfsm/test.txt",
"perms": false,
"time": false,
"all": false,
"path": false,
"id": null
},
"ts": 1760359912131092174,
"version": "0.1.0"
},
"response": {
"raw": {
"pathname": "/tmp/temporary-test-jfsm/test.txt",
"dev": 49,
"inode": 29674,
"nlink": 1,
"size": 20,
"blksize": 4096,
"blocks": 8,
"rdev": 0,
"ftvalue": "S_IFREG",
"mode": 33188,
"uid": 1000,
"gid": 1000,
"atime": 635036400,
"mtime": 1673823600,
"ctime": 1760359912,
"atimensec": 0,
"mtimensec": 0,
"ctimensec": 109881944
},
"ts": 1760359912131157115
}
}
error message will contain:
code: code at integer
message: error message as String
| Code | Value | Description |
|---|---|---|
| 6 | PATH-NOT-EXIST | The filepath does not exist. No such address: The specified address is unavailable. |
| 65 | PARSING-ERROR | Data format error: The input data format is incorrect or unexpected. |
| 77 | PERMISSION-ERROR | Permission denied: The user or process lacks sufficient privileges. |
cargo build --release
cargo test
test.txttest.sh