sanack / node-jq

Node.js wrapper for jq

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow `.jsonl`

jnrepo opened this issue ยท comments

Description

Please add jsonl as a format that is supported. .jsonl is the same format as .json, except it isn't limited by a 2GB file limit. The jq library already works with .jsonl as well. I have a pull request written up as well. Thanks.

Test Source

Save the snippet below as test.jsonl and try running it with node-jq.

{
  "name": "node-jq",
  "version": "0.0.0-semantic-release",
  "description": "Run jq in node",
  "main": "lib/jq.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/sanack/node-jq"
  },
  "contributors": [
    {
      "name": "davesnx",
      "email": "dsnxmoreno@gmail.com"
    },
    {
      "name": "mackermans",
      "email": "maarten.ackermans@gmail.com"
    }
  ]
}

Error Message & Stack Trace

Error [ValidationError]: node-jq: invalid path argument supplied (not a .json file): "/Users/me/Downloads/test.jsonl"
    at Object.exports.process (/Users/me/code/node-jq/node_modules/joi/lib/errors.js:193:16)
    at Object.internals.entry (/Users/me/code/node-jq/node_modules/joi/lib/validator.js:153:26)
    at Object.exports.entry (/Users/me/code/node-jq/node_modules/joi/lib/validator.js:27:30)
    at internals.Base.validate (/Users/me/code/node-jq/node_modules/joi/lib/base.js:548:26)
    at Object.internals.assert (/Users/me/code/node-jq/node_modules/joi/lib/index.js:225:27)
    at Object.attempt (/Users/me/code/node-jq/node_modules/joi/lib/index.js:107:26)
    at validateArguments (/Users/me/code/node-jq/lib/command.js:83:33)
    at Object.commandFactory (/Users/me/code/node-jq/lib/command.js:111:18)
    at /Users/me/code/node-jq/lib/jq.js:16:33
    at new Promise (<anonymous>) {
  _original: {
    filter: '{id}',
    json: '/Users/me/Downloads/test.jsonl'
  },
  details: [
    {
      message: 'node-jq: invalid path argument supplied (not a .json file): "/Users/me/Downloads/test.jsonl"',
      path: [ 'json' ],
      type: 'any.invalid',
      context: {
        type: 'json',
        label: 'path',
        value: '/Users/me/Downloads/test.jsonl',
        key: 'json'
      }
    }
  ]
}

Environment

Tell us which operating system you are using, as well as which versions of Node.js, npm/yarn, and node-jq.

Run the following to get it quickly:
nodejs version:

v16.15.1

yarn version:

1.22.19

npm version:

9.6.7

node-jq version:

"version": "0.0.0-automated-versioning",

๐ŸŽ‰ This issue has been resolved in version 3.0.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€