p2.node([...])
.file('file or title', options, function (err) { ... });
Options:
Operand | Type | Description |
---|---|---|
path | String | File path, overrides title |
ensure | String | Present, absent, file, directory, link |
target | String | target for symlink |
content | String | Content of file, can be object containing {file: 'filaname'} or {template: 'template file'} |
is_template | Boolean | Content is a template |
mode | String | Octal file mode |
owner | String | Owner of this file object |
group | String | Group owner of this file object |
watch | Boolean | Watch this file object for changes and reapply policy |
Templates use the Mustache templating library.
also supports:
Watches for real-time reapplication of policy when a file object is changed
.watch(true)
.file('your_file_to_watch', {ensure: 'file', content: 'template_file'})
.watch(false)
...
Platform Support (i.e. tested on):
Platform/OS | Support Status | Unit Tests |
---|---|---|
Linux/all | ✓ | ✓ |
Windows/10 | ✓ | ✓ |
Pi/Raspbian jessie | ✓ | ✓ |
Templates:
Uses Mustache so variables can be inserted e.g.:
{{ title }}
{{ opts.something }}
{{ f.factname }}