<commit_before>This is a node.js module that provides libcap-ng bindings to modify the
capabilities of the current process.

The most likely use for this is obviously setting `CAP_NET_BIND_SERVICE`
to enable binding to privileged ports such as 80 or 443.

To use a capability this the user running the program needs to have the
capability, too. This can be achieved by using `pam_cap` and granting the
capability via the `/etc/security/capability.conf` file.<commit_msg>Add some more documentation<commit_after>This is a node.js module that provides libcap-ng bindings to modify the
capabilities of the current process.

The most likely use for this is obviously setting `CAP_NET_BIND_SERVICE`
to enable binding to privileged ports such as 80 or 443.

To use a capability this the user running the program needs to have the
capability, too. This can be achieved by using `pam_cap` and granting the
capability via the `/etc/security/capability.conf` file.

Unfortunately the node binary *also* needs the capability - but only in its
*inheritable* set. Executing `setcap cap_net_bind_service+i /usr/bin/node` as
root does the job.

# Usage:

    var caps = require('posix-caps-ng');
    caps.set_cap(caps.CAP_NET_ADMIN, caps.EFFECTIVE, true);

If the application does not start any child processes which also need this cap,
it is a good idea to clear it from the *inheritable* set after enabling it and
possibly also removing the cap altogether after binding to the privileged port:

    caps.set_cap(caps.CAP_NET_ADMIN, caps.ALL, false);

# Functions

* `bool has_cap(cap, type)` - check if the given cap is set
* `bool set_cap(cap, types, set)` - set/remove the given cap
* `bool clear_caps()` - remove all caps
* `string get_caps(type)` - get a string containing all set caps

`type` can be one of `caps.EFFECTIVE`, `caps.PERMITTED`, `caps.INHERITABLE`.
`types` can be any combination (binary OR) of those flags.
{'fraction_non_alphanumeric': 0.06847882906429692, 'fraction_numerical': 0.005227391531625719, 'mean_word_length': 4.531791907514451, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1707610', 'n_tokens_mistral': 568, 'n_tokens_neox': 547, 'n_words': 266}