Movatterモバイル変換


[0]ホーム

URL:


top
chmod-cli logochmod-cli

Buy me a coffeeCINPM DownloadsNPM version

A simple command line tool for changing file permissions. TheUNIX commandchmod 777 filename for node.

Installation

$npminstall chmod-cli# Or$npminstall--global chmod-cli

Usage

$ chmod-cli--help  A simplecommand line toolfor changingfile permissions.  Usage: $ chmod-cli<path>  Options:    --version,-v   Show version number    --help,-h      Displayshelp information.    --mode,-m      The new permissionsfor thefile or directory.                    This can be a numeric mode(e.g.666),                    or a string mode(e.g.'rwxr-xr-x')  Examples:    $ chmod-cli test.js xxx.js-m 0o777    $ chmod-cli test.js-m 0o777    $ chmod-cli test.js-m 0o777

API

chmod(path, mode, callback)

Changes the permissions of the file or directory at the specifiedpath.

importchmodfrom'chmod-cli';chmod('./test.txt','666',(err)=>{if(err)throw err;console.log('File permissions have been changed.');});

File Permissions Explanation

In 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:

Therefore,777 means:

In total, this makes777, 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.

License

This package is licensed under the MIT License.

Released under the MIT License. Copyright © 2024 Kenny Wong
Generated byidoc v1.31.0

[8]ページ先頭

©2009-2025 Movatter.jp