http.ndjson
Read an NDJSON response to a GET or a POST as a stream of parsed lines
CLI- Package
- @procedures/http · README
- Path
["http","ndjson"]- CLI
mark http ndjson --url <string>- As data
{"$proc":["http","ndjson"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/http/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["http","ndjson"], { url: "<url>" });
console.log(JSON.stringify(result));From the command line
$ mark http ndjson --url <string>
As data, in a program
{ "$proc": ["http", "ndjson"], "input": { "url": "<url>" } }Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | yes | The URL: http: or https: | |
method | "GET" | "POST" | no | GET or POST (default: POST with body or json, GET without them) | |
headers | object | no | The headers of the request | |
query | object | no | More parameters for the query of the URL. A list gives the parameter more than one time | |
body | string | no | A body of text for a POST | |
json | any | no | A body of JSON for a POST: the procedure sets content-type: application/json | |
timeoutMs | integer | no | The time of the whole stream, in milliseconds (default: no limit) | |
idleTimeoutMs | integer | no | The longest time without data, in milliseconds (default: no limit) | |
maxLineBytes | integer | no | The largest line, in bytes (default: 1 MiB) |
Output
The schema does not list fields (any).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri",
"description": "The URL: http: or https:"
},
"method": {
"description": "GET or POST (default: POST with body or json, GET without them)",
"type": "string",
"enum": [
"GET",
"POST"
]
},
"headers": {
"description": "The headers of the request",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "string"
}
},
"query": {
"description": "More parameters for the query of the URL. A list gives the parameter more than one time",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": [
"string",
"number",
"boolean"
]
},
{
"type": "array",
"items": {
"type": [
"string",
"number",
"boolean"
]
}
}
]
}
},
"body": {
"description": "A body of text for a POST",
"type": "string"
},
"json": {
"description": "A body of JSON for a POST: the procedure sets content-type: application/json"
},
"timeoutMs": {
"description": "The time of the whole stream, in milliseconds (default: no limit)",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 86400000
},
"idleTimeoutMs": {
"description": "The longest time without data, in milliseconds (default: no limit)",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 86400000
},
"maxLineBytes": {
"description": "The largest line, in bytes (default: 1 MiB)",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"url"
]
},
"output": {
"description": "The JSON value of one line"
}
}