Add Flatbuffers support to NodeJS bindings

This commit is contained in:
Siarhei Fedartsou 2022-08-27 14:10:29 +02:00
parent 44db19a1a2
commit b296165489
2 changed files with 18 additions and 14 deletions

View File

@ -334,13 +334,15 @@ specific behaviours.
- `plugin_config` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Object literal containing parameters for the trip query. - `plugin_config` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Object literal containing parameters for the trip query.
- `plugin_config.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The format of the result object to various API calls. - `plugin_config.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The format of the result object to various API calls.
Valid options are `object` (default if `options.format` is `json`), which returns a Valid options are `object` (default if `options.format` is
standard Javascript object, as described above, and `buffer`(default if `options.format` is `flatbuffers`), which will return a NodeJS `json`), which returns a standard Javascript object, as described above, and `buffer`(default if
**[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string or Flatbuffers object. The latter has `options.format` is `flatbuffers`), which will return a NodeJS
the advantage that it can be immediately serialized to disk/sent over the network, and the **[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string or Flatbuffers
generation of the string is performed outside the main NodeJS event loop. This option is ignored object. The latter has the advantage that it can be immediately serialized to disk/sent over the
by the `tile` plugin. Also note that `options.format` set to `flatbuffers` cannot be used with `plugin_config.format` set to `object`. network, and the generation of the string is performed outside the main NodeJS event loop. This
`json_buffer` is deprecated alias for `buffer`. option is ignored by the `tile` plugin. Also note that `options.format` set to `flatbuffers`
cannot be used with `plugin_config.format` set to `object`. `json_buffer` is deprecated alias for
`buffer`.
**Examples** **Examples**

View File

@ -627,13 +627,15 @@ NAN_METHOD(Engine::trip) //
* @name Configuration * @name Configuration
* @param {Object} [plugin_config] - Object literal containing parameters for the trip query. * @param {Object} [plugin_config] - Object literal containing parameters for the trip query.
* @param {String} [plugin_config.format] The format of the result object to various API calls. * @param {String} [plugin_config.format] The format of the result object to various API calls.
* Valid options are `object` (default if `options.format` is `json`), which returns a * Valid options are `object` (default if `options.format` is
* standard Javascript object, as described above, and `buffer`(default if `options.format` is `flatbuffers`), which will return a NodeJS * `json`), which returns a standard Javascript object, as described above, and `buffer`(default if
* **[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string or Flatbuffers object. The latter has * `options.format` is `flatbuffers`), which will return a NodeJS
* the advantage that it can be immediately serialized to disk/sent over the network, and the * **[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string or Flatbuffers
* generation of the string is performed outside the main NodeJS event loop. This option is ignored * object. The latter has the advantage that it can be immediately serialized to disk/sent over the
* by the `tile` plugin. Also note that `options.format` set to `flatbuffers` cannot be used with `plugin_config.format` set to `object`. * network, and the generation of the string is performed outside the main NodeJS event loop. This
* `json_buffer` is deprecated alias for `buffer`. * option is ignored by the `tile` plugin. Also note that `options.format` set to `flatbuffers`
* cannot be used with `plugin_config.format` set to `object`. `json_buffer` is deprecated alias for
* `buffer`.
* *
* @example * @example
* var osrm = new OSRM('network.osrm'); * var osrm = new OSRM('network.osrm');