{"id":19247986,"url":"https://github.com/tsedio/ts-gphoto2-driver","last_synced_at":"2025-09-19T05:11:32.126Z","repository":{"id":39244372,"uuid":"138393456","full_name":"tsedio/ts-gphoto2-driver","owner":"tsedio","description":"📷 A Node.js wrapper for libgphoto2 written in TypeScript. Useful for remote controlling of DSLRs and other digital cameras supported by gphoto2.","archived":false,"fork":false,"pushed_at":"2024-01-01T10:58:36.000Z","size":9050,"stargazers_count":76,"open_issues_count":6,"forks_count":21,"subscribers_count":14,"default_branch":"production","last_synced_at":"2024-11-01T10:46:41.471Z","etag":null,"topics":["camera","camerafile","gphoto2","gphoto2-driver","hacktoberfest","libgphoto2","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/tsedio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":["romakita"],"patreon":null,"open_collective":"tsed","ko_fi":null,"tidelift":null,"community_bridge":null,"custom":null}},"created_at":"2018-06-23T10:48:58.000Z","updated_at":"2024-09-12T02:01:46.000Z","dependencies_parsed_at":"2024-06-21T03:12:38.259Z","dependency_job_id":"aa27bc77-acd2-49ac-a07c-6b4d33a1613e","html_url":"https://github.com/tsedio/ts-gphoto2-driver","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsedio%2Fts-gphoto2-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsedio%2Fts-gphoto2-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsedio%2Fts-gphoto2-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsedio%2Fts-gphoto2-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsedio","download_url":"https://codeload.github.com/tsedio/ts-gphoto2-driver/tar.gz/refs/heads/production","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223863952,"owners_count":17216234,"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":["camera","camerafile","gphoto2","gphoto2-driver","hacktoberfest","libgphoto2","typescript"],"created_at":"2024-11-09T18:06:04.196Z","updated_at":"2025-09-19T05:11:27.078Z","avatar_url":"https://github.com/tsedio.png","language":"TypeScript","funding_links":["https://github.com/sponsors/romakita","https://opencollective.com/tsed"],"categories":[],"sub_categories":[],"readme":"\u003cp style=\"text-align: center\" align=\"center\"\u003e\n \u003ca href=\"https://tsed.io\" target=\"_blank\"\u003e\u003cimg src=\"https://tsed.io/tsed-og.png\" width=\"200\" alt=\"Ts.ED logo\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eTs.ED GPhotoDriver2\u003c/h1\u003e\n \n[![Build \u0026 Release](https://github.com/tsedio/ts-gphoto2-driver/actions/workflows/build.yml/badge.svg)](https://github.com/tsedio/ts-gphoto2-driver/actions/workflows/build.yml)\n[![PR Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/tsedio/ts-gphoto2-driver/blob/master/CONTRIBUTING.md)\n[![Coverage Status](https://coveralls.io/repos/github/tsedio/ts-gphoto2-driver/badge.svg?branch=production)](https://coveralls.io/github/tsedio/ts-gphoto2-driver?branch=production)\n[![npm version](https://badge.fury.io/js/%40tsed%2Fgphoto2-driver.svg)](https://badge.fury.io/js/%40tsed%2Fgphoto2-driver)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n[![backers](https://opencollective.com/tsed/tiers/badge.svg)](https://opencollective.com/tsed)\n\n  \u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://api.tsed.io/rest/slack/tsedio/tsed\"\u003eSlack\u003c/a\u003e\n  \u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n  \u003ca href=\"https://twitter.com/TsED_io\"\u003eTwitter\u003c/a\u003e\n\u003c/div\u003e\n  \u003chr /\u003e\n\u003c/div\u003e\n\nA Node.js wrapper for libgphoto2 written in TypeScript. Useful for remote controlling of DSLRs and other digital cameras supported by gphoto2.\n\n## Features\n\n- Camera autodetection,\n- Take a picture/movie capture,\n- Take a preview,\n- Retrieve camera list,\n- Select camera,\n- Take a liveview from camera and get binary or base64 of each frame, or write it to file,\n- Display info about your camera (summary, about, manual).\n\n## Know issue\n\nThis package isn't compatible with Node.js 13 and higher version. `@tsed/gphoto2-driver use` `ref-array-napi` which have a\nbug with some node.js version related [here](https://github.com/node-ffi-napi/ref-napi/issues/47).\n\nThe possible solutions would be:\n\n- Find a way not to use ref-array-napi to manipulate C++ Array in Node.js,\n- That the author of the module finds a solution to correct the problem,\n- Redevelop the driver directly with NAPI.\n\nObviously any help is welcome to move the project forward :)\n\n## Prerequisite\n\n- Node.js: 12\n- NPM: ~7.10.0\n- Nan: ~2.8.0\n- libgphoto2: ~2.5.x - via `brew install libgphoto2`, `apt-get install libgphoto2-dev` or download and build from `http://www.gphoto.org/proj/libgphoto2/`,\n- pkg-config | dpkg (used for dependency checking)\n- clang compiler\n\n\u003e Note: This package cannot be used in front-end context (like webpack, browserify, etc...). You have to develop your own web server and expose your API.\n\n## Installation\n\n### Linux / Mac OS Intel\n\n```bash\nbrew install libgphoto2\n\n// or\napt-get install libgphoto2-dev\n\n// then\nnpm install @tsed/gphoto2-driver\n```\n\n### Mac OS M1 (Rosetta)\n\nOn Mac M1 chipset, you have to install homebrew with the x64 architecture:\n\n```bash\n/usr/sbin/softwareupdate --install-rosetta\n\narch -x86_64 zsh\nmkdir ~/Downloads/homebrew\ncurl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew\nsudo mv ~/Downloads/homebrew /usr/local/homebrew\nsudo chmod 755 /usr/local/homebrew/bin/brew\narch -x86_64 /usr/local/homebrew/bin/brew install libgphoto2\n\narch -arm64 zsh\n```\n\nCreate brew alias. Edit your `~/.zshrc` file and add the followings lines:\n\n```sh\nexport PATH=$HOME/bin:/usr/local/bin:$PATH\n\nalias xbrew='arch -x86_64 /usr/local/homebrew/bin/brew'\n```\n\nNow you can run brew with x64 architecture by usin `xbrew` alias:\n\n```sh\nxbrew install libgphoto2\n```\n\nYou also need to install Node.js with the appropriate:\n\n```sh\narch -x86_64 zsh\nnvm install v12\nnvm use v12\nnpm install @tsed/gphoto2-driver\narch -arm64 zsh\n```\n\n## Check if your camera is detected\n\nGPhoto2 CLI can help you to know if your camera is correctly detected by the libphoto2 driver. It can help to determine if the\nthe detection issue is related from the driver or from the Ts.ED GPhoto2 library.\n\nInstall the GPhoto2 CLI:\n\n```bash\n// MacOs\nbrew install gphoto2\n\n// Linux\nsudo apt install gphoto2\n```\n\n## Demo\n\nRun:\n\n```sh\nyarn start\n```\n\nThen open the browser on `http://localhost:3000`\n\nThe demo code source is inside `packages/client` and `packages/server`.\n\n## Usage\n\nHere an example with TypeScript (works also with pure javascript in Node.js):\n\n```typescript\nimport Path from \"path\";\nimport {CameraList, run} from \"@tsed/gphoto2-driver\";\n\nrun(\n  () =\u003e {\n    const cameraList = new CameraList().load();\n\n    if (cameraList.size) {\n      const camera = cameraList.getCamera(0);\n      const cameraFile = camera.captureImage();\n\n      cameraFile.save(path.join(__dirname, \"capture.jpeg\"));\n    }\n  },\n  {logLevel: \"debug\"}\n);\n```\n\n## CameraFile\n\nA lot of different API's of this library returns a CameraFile object.\n\nThis object does not contain the image, it is just a pointer to the file in camera's RAM.\n\nYou have several options to get your image:\n\n1. Use `.save(filename)` of `.saveAsync(filename)` methods, that will save the image to your filesystem.\n2. Use `.getDataAndSizeAsync('binary' | 'base64')` method, which returns following object:\n\n```\n{\n  data: data, // Buffer for binary format and string for base64.\n  size: size\n}\n```\n\n## Examples\n\nSome examples are available in the `packages/examples/src` directory, when you have cloned or downloaded the complete project from github.\n\nCheckout this project then run `npm run install:examples \u0026\u0026 npm run develop` and run `node examples/camera.ts`.\n\n## Contribute\n\nContributors and PR are welcome. Before, just read [contributing guidelines here](./CONTRIBUTING.md) ;)\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 - 2021 Romain Lenzotti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsedio%2Fts-gphoto2-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsedio%2Fts-gphoto2-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsedio%2Fts-gphoto2-driver/lists"}