{"id":25778185,"url":"https://github.com/alandoherty/node-lxd","last_synced_at":"2025-02-27T06:29:53.788Z","repository":{"id":75328371,"uuid":"51362821","full_name":"alandoherty/node-lxd","owner":"alandoherty","description":"A client for linux containers (lxd)","archived":false,"fork":false,"pushed_at":"2019-02-01T11:53:16.000Z","size":81,"stargazers_count":43,"open_issues_count":7,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-19T19:39:48.262Z","etag":null,"topics":["api","linux-containers","lxd","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alandoherty.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2016-02-09T11:28:53.000Z","updated_at":"2024-03-08T02:58:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"fdba483d-bc1c-4cd4-bbbc-ea02ee36cea5","html_url":"https://github.com/alandoherty/node-lxd","commit_stats":{"total_commits":49,"total_committers":4,"mean_commits":12.25,"dds":"0.26530612244897955","last_synced_commit":"2317dd7e57a2dfe1331cbd2c03329d4027e42375"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alandoherty%2Fnode-lxd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alandoherty%2Fnode-lxd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alandoherty%2Fnode-lxd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alandoherty%2Fnode-lxd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alandoherty","download_url":"https://codeload.github.com/alandoherty/node-lxd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240989499,"owners_count":19889699,"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":["api","linux-containers","lxd","nodejs"],"created_at":"2025-02-27T06:29:53.298Z","updated_at":"2025-02-27T06:29:53.766Z","avatar_url":"https://github.com/alandoherty.png","language":"JavaScript","readme":"[![npm version](https://badge.fury.io/js/node-lxd.svg)](https://badge.fury.io/js/node-lxd)\n\nA client for communicating with a local or remote instance of linux containers. The interface is object-oriented, simple and uniform. Unrestrictive with an open MIT license.\n\n# Installing\n\n```bash\n$ npm install --save node-lxd\n```\n\n## Getting Started ##\n\nThe following example connects to the local LXC instance and launches a new container.\n\n```js\nvar lxd = require(\"node-lxd\");\n\nvar client = lxd();\n\nclient.create(\"myContainer\", \"ubuntu\", function(err, container) {\n    container.start(function(err) {\n        if (!err)\n            console.log(\"Started \" + container.name());\n    });\n});\n```\n\n## Example ##\n\nThe following example uses an express application to allow users to create containers and execute commands.\n\n```js\n// requires\nvar express = require(\"express\");\nvar lxd = require(\"node-lxd\");\nvar client = lxd();\nvar app = express();\n\nvar containers = {};\n\napp.post(\"/create\", function(req, res) {\n\tclient.launch(req.query.name, function(err, container) {\n\t\tif (err) res.json({success: false, message: err.getMessage()});\n\t\telse {\n\t\t\tcontainers[req.query.name] = container;\n\t\t\tres.json({success: true, message: \"Container launched\"});\n\t\t}\n\t});\n});\n\napp.post(\"/run\", function(req, res) {\n\tif (!containers.hasOwnProperty(req.query.name)) {\n\t\tres.json({success: false, message: \"Container does not exist\"});\n\t\treturn;\n\t}\n\n\tcontainers[req.query.name].run(req.query.cmd.split(\" \"), function(err, stdOut, stdErr) {\n\t\tif (err) res.json({success: false, message: err.getMessage()});\n\t\telse if (stdErr.length \u003e 0) res.json({success: false, message: stdErr});\n\t\telse {\n\t\t\tres.json({success: true, message: stdOut});\n\t\t}\n\t});\n});\n\napp.listen(3000, function(err) {\n\tif (!err)\n\t\tconsole.log(\"listening on port 3000\");\n});\n```\n\n## Documentation ##\n\nThe client class is documented [here](https://github.com/alandoherty/node-lxd/blob/master/docs/client.md).\n\nThe container class is documented [here](https://github.com/alandoherty/node-lxd/blob/master/docs/container.md).\n\nThe process class is documented [here](https://github.com/alandoherty/node-lxd/blob/master/docs/process.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falandoherty%2Fnode-lxd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falandoherty%2Fnode-lxd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falandoherty%2Fnode-lxd/lists"}