{"id":15777238,"url":"https://github.com/jaywcjlove/chmod-cli","last_synced_at":"2025-03-14T08:30:26.311Z","repository":{"id":131899979,"uuid":"611822439","full_name":"jaywcjlove/chmod-cli","owner":"jaywcjlove","description":"A simple command line tool for changing file permissions, A `chmod 777 filename` util for nodejs.","archived":false,"fork":false,"pushed_at":"2024-06-27T19:00:40.000Z","size":60,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-29T11:30:27.338Z","etag":null,"topics":["chmod","cli","command-line","nodejs","tool"],"latest_commit_sha":null,"homepage":"http://jaywcjlove.github.io/chmod-cli/","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/jaywcjlove.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"ko_fi":"jaywcjlove","buy_me_a_coffee":"jaywcjlove","custom":["https://www.paypal.me/kennyiseeyou","https://jaywcjlove.github.io/#/sponsor"]}},"created_at":"2023-03-09T16:05:37.000Z","updated_at":"2024-06-27T19:00:13.000Z","dependencies_parsed_at":"2024-11-07T15:34:06.293Z","dependency_job_id":null,"html_url":"https://github.com/jaywcjlove/chmod-cli","commit_stats":{"total_commits":33,"total_committers":2,"mean_commits":16.5,"dds":0.06060606060606055,"last_synced_commit":"2155be3378c867f3640684a8de3a3aa2c512d38a"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Fchmod-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Fchmod-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Fchmod-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Fchmod-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaywcjlove","download_url":"https://codeload.github.com/jaywcjlove/chmod-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243466985,"owners_count":20295309,"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":["chmod","cli","command-line","nodejs","tool"],"created_at":"2024-10-04T17:43:19.043Z","updated_at":"2025-03-14T08:30:26.272Z","avatar_url":"https://github.com/jaywcjlove.png","language":"JavaScript","funding_links":["https://ko-fi.com/jaywcjlove","https://buymeacoffee.com/jaywcjlove","https://www.paypal.me/kennyiseeyou","https://jaywcjlove.github.io/#/sponsor"],"categories":[],"sub_categories":[],"readme":"\u003c!--idoc:ignore:start--\u003e\nchmod-cli\n===\n\u003c!--idoc:ignore:end--\u003e\n\n[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor)\n[![CI](https://github.com/jaywcjlove/chmod-cli/actions/workflows/main.yml/badge.svg)](https://github.com/jaywcjlove/chmod-cli/actions/workflows/main.yml)\n[![NPM Downloads](https://img.shields.io/npm/dm/chmod-cli.svg?style=flat)](https://www.npmjs.com/package/chmod-cli)\n[![](https://jaywcjlove.github.io/sb/ico/npm.svg)](https://www.npmjs.com/package/chmod-cli) \n[![NPM version](https://img.shields.io/npm/v/chmod-cli.svg?style=flat)](https://npmjs.org/package/chmod-cli)\n\n\nA simple command line tool for changing file permissions. The [UNIX command](https://en.wikipedia.org/wiki/Chmod) `chmod 777 filename` for node.\n\n## Installation\n\n```shell\n$ npm install chmod-cli\n# Or\n$ npm install --global chmod-cli\n```\n\n## Usage\n\n```bash\n$ chmod-cli --help\n\n  A simple command line tool for changing file permissions.\n\n  Usage: $ chmod-cli \u003cpath\u003e …\n\n  Options:\n\n    --version, -v   Show version number\n    --help, -h      Displays help information.\n    --mode, -m      The new permissions for the file or directory.\n                    This can be a numeric mode (e.g. 666),\n                    or a string mode (e.g. 'rwxr-xr-x')\n\n  Examples:\n\n    $ chmod-cli test.js xxx.js -m 0o777\n    $ chmod-cli test.js -m 0o777\n    $ chmod-cli test.js -m 0o777\n\n```\n\n## API\n\n`chmod(path, mode, callback)`\n\nChanges the permissions of the file or directory at the specified `path`.\n\n- `path` (**string**): The path to the file or directory.\n- `mode` (**string** or **number**): The new permissions for the file or directory. This can be a numeric mode (e.g. 666), or a string mode (e.g. 'rwxr-xr-x').\n- `callback` (**function**): A callback function to call when the operation completes. The callback should take one argument, an error object, which will be null if the operation completes successfully.\n\n```javascript\nimport chmod from 'chmod-cli';\n\nchmod('./test.txt', '666', (err) =\u003e {\n  if (err) throw err;\n  console.log('File permissions have been changed.');\n});\n```\n\n## File Permissions Explanation\n\nIn the numeric notation of file permissions, each digit represents a file permission group (owner permission, user group permission, other user permission). In this notation, the numeric value for each permission is:\n\n- Read permission: `4`\n- Write permission: `2`\n- Execute permission: `1`\n\nTherefore, `777` means:\n\n- Owner permission: **Read** (4), **Write** (2), **Execute** (1) = `4+2+1 = 7`\n- User group permission: **Read** (4), **Write** (2), **Execute** (1) = `4+2+1 = 7`\n- Other user permission: **Read** (4), **Write** (2), **Execute** (1) = `4+2+1 = 7`\n\nIn total, this makes `777`, which means that the file's owner, members of the same user group, and all other users can read, write, and execute that file. This permission configuration is very open and should be used with caution.\n\n\n## License\n\nThis package is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaywcjlove%2Fchmod-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaywcjlove%2Fchmod-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaywcjlove%2Fchmod-cli/lists"}