Skip to content

Commit

Permalink
Polish examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Feb 7, 2025
1 parent b168788 commit 04c3768
Showing 1 changed file with 40 additions and 20 deletions.
60 changes: 40 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,46 @@ Options:
## Examples
Then you can do this wonderful requests in terminal
```bash
# get a single field, e.g. version
jora version <package.json
# get all top level dependencies count
jora -i package.json -q '(dependencies.keys() + devDependencies.keys()).size()'
# find packages with more than a single version (run query from a file)
npm ls --json | jora find-multi-version-packages.jora
```
> The content of `find-multi-version-packages.jora` may be as follows:
>
> ```js
> ..(dependencies.entries().({ name: key, ...value }))
> .group(=>name, =>version)
> .({ name: key, versions: value })
> .[versions.size() > 1]
> ```
- Get a single field from, e.g. "version":
```bash
jora version <package.json
```
- Get all top level dependencies count:
```bash
jora -i package.json -q '(dependencies.keys() + devDependencies.keys()).size()'
```
- Find packages with more than a single version (run query from a file)
```bash
npm ls --json | jora find-multi-version-packages.jora
```
The content of `find-multi-version-packages.jora` may be as follows:
```js
..(dependencies.entries().({ name: key, ...value }))
.group(=>name, =>version)
.({ name: key, versions: value })
.[versions.size() > 1]
```
- `jora-cli` supports queries from JSONXl, and conversion between JSON and JSONXL. JSONXL is a binary replacement for JSON. It is supported by any app built on [Discovery.js](https://github.com/discoveryjs/discovery), including [JsonDiscovery](https://github.com/discoveryjs/JsonDiscovery), [CPUpro](https://github.com/discoveryjs/cpupro) and [Statoscope](https://github.com/statoscope/statoscope). JSONXL not only saves space and transfer time but also offers faster decoding and a lower memory footprint, which is beneficial for processing large datasets.
- Queries for JSONXL input work the same ways as for JSON:
```bash
jora <input.jsonxl "select.something"
```
- Convert JSON into JSONXL:
```bash
jora <input.json >output.jsonxl -e jsonxl
```
- Convert JSONXL into JSON
```
jora <input.jsonxl >output.json
```
## Caveats
Expand Down

0 comments on commit 04c3768

Please sign in to comment.