{"id":22422108,"url":"https://github.com/abumq/residue-node","last_synced_at":"2026-04-29T00:04:23.941Z","repository":{"id":57354574,"uuid":"87147083","full_name":"abumq/residue-node","owner":"abumq","description":"Official Node.js client library to interact with residue logging server seamlessly. This is built using Node.js built-in modules (net, crypto).","archived":false,"fork":false,"pushed_at":"2023-06-03T07:56:34.000Z","size":846,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-03T19:07:01.391Z","etag":null,"topics":["logging-library","nodejs","nodejs-library","remote-logging","residue","residue-client","residue-tools"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abumq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-04T04:16:10.000Z","updated_at":"2024-04-05T22:40:39.000Z","dependencies_parsed_at":"2025-02-01T10:34:45.317Z","dependency_job_id":null,"html_url":"https://github.com/abumq/residue-node","commit_stats":null,"previous_names":["abumq/residue-node","amrayn/residue-node"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abumq%2Fresidue-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abumq%2Fresidue-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abumq%2Fresidue-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abumq%2Fresidue-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abumq","download_url":"https://codeload.github.com/abumq/residue-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245786746,"owners_count":20671802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["logging-library","nodejs","nodejs-library","remote-logging","residue","residue-client","residue-tools"],"created_at":"2024-12-05T17:11:45.014Z","updated_at":"2026-04-29T00:04:23.908Z","avatar_url":"https://github.com/abumq.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e﷽\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    Residue Node.js Client\n    \u003cp align=\"center\"\u003eSecure Node.js library to interact with residue server seamlessly.\u003c/p\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca aria-label=\"Build Status\" href=\"https://travis-ci.org/abumq/residue-node/branches\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/travis/abumq/residue-node/master.svg?style=for-the-badge\u0026labelColor=000000\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"NPM version\" href=\"https://www.npmjs.com/package/residue\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/npm/v/residue.svg?style=for-the-badge\u0026labelColor=000000\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"License\" href=\"https://github.com/abumq/residue-node/blob/master/LICENSE\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/npm/l/residue?style=for-the-badge\u0026labelColor=000000\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"Donate via PayPal\" href=\"https://amrayn.com/donate\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/static/v1?label=Donate\u0026message=PayPal\u0026color=purple\u0026style=for-the-badge\u0026labelColor=000000\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nThis module provides interface for connecting and interacting with residue server seamlessly, means, once you are connected this module takes care of expired tokens and clients and keep itself updated with latest tokens and ping server when needed to stay alive.\n\n## API\n#### `connect(options)`\nConnects application to residue using params. If options is not specified, you should use `loadConfiguration` to load the options\n\nValid options are:\n\n```\n{\n    url: \"\u003chost_where_residue_server_is_listening\u003e:\u003cresidue_connection_port\u003e\",\n    application_id: \u003capp_name [optional]\u003e,\n    rsa_key_size: \u003ckey_size_for_initial_final_key_transmission [optional]\u003e,\n    utc_time: \u003cwhether_to_use_UTC_time [optional]\u003e,\n    time_offset: \u003ctime_offset_in_seconds [optional]\u003e,\n    client_id: \u003cclient_id_that_server_knows_you_as [optional]\u003e,\n    client_private_key: \u003cfull_path_of_private_key\u003e [must be provided with client_id],\n    client_public_key: \u003cfull_path_of_public_key\u003e [must be provided with client_id],\n    client_key_secret: \u003cbase16 encoded secret (passphrase) for encrypted private key if any\u003e,\n    server_public_key: \u003cfull_path_of_server_public_key\u003e\n}\n```\n\nPlease refer to [`loadConfiguration`](https://abumq.github.io/residue/docs/class_residue.html#a8292657c93a775b6cbf22c6d4f1166f4) in our C++ library's documentation for more details.\n\n#### `loadConfiguration(jsonFilename)`\nLoads configurations / options via json file. Returns true if successfully loaded, otherwise false.\n\nThis does not verify the options. Options are validated in `connect()` function\n\n#### `getLogger(logger_id)`\nReturns logger class for logging interface\n\n## Usage\n```js\nconst ResidueClient = require('residue');\n\nconst residue = new ResidueClient();\n\nconst logger = residue.getLogger('sample-app');\n\nconst confFile = 'client.conf.json';\nif (residue.loadConfiguration(confFile)) {\n    residue.connect();\n}\n\n// or\n// residue.loadConfiguration({ url: ... })\n// or\n// residue.loadConfiguration('{ url: ... }')\n\n// ALTERNATIVELY\nresidue.connect({\n    url: ...\n});\n\nlogger.info('simple log');\n\nlogger.info('array %s', [1, 2, 3]);\n\nvar person = { 'name': 'Adam', 'age': 960, }\nlogger.info('obj %s', person);\n\nlogger.info('null %s', null);\n\nlogger.info('undefined %s', undefined);\n\n```\n\n## Log\n```js\nlogger.info(...);\nlogger.warn(...);\nlogger.error(...);\nlogger.debug(...);\nlogger.trace(...);\nlogger.fatal(...);\nlogger.verbose(verbose_level, ...);\n```\n\n## Native Binding\nResidue Node.js also comes with native binding that uses [C++ client library](https://github.com/abumq/residue-cpp) to manage connections and asyncronous requests.\n\nIf you have installed [`residue-native`](https://www.npmjs.com/package/residue-native) package alongside `residue`, native binding will be used otherwise it will fallback to JS implementation.\n\n## Sample\nYou can check out [sample client apps](https://github.com/abumq/residue-node/blob/master/samples) for practical use of this package.\n\n## License\n```\nCopyright 2017-present @abumq (Majid Q.)\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabumq%2Fresidue-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabumq%2Fresidue-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabumq%2Fresidue-node/lists"}