1 | writeout
|
2 | ==========
|
3 |
|
4 |
|
5 | This file is generated by ape-tmpl. Do not update manually.
|
6 | --->
|
7 |
|
8 |
|
9 | <a name="badges"></a>
|
10 |
|
11 | [![Build Status][bd_travis_shield_url]][bd_travis_url]
|
12 | [![Code Climate][bd_codeclimate_shield_url]][bd_codeclimate_url]
|
13 | [![Code Coverage][bd_codeclimate_coverage_shield_url]][bd_codeclimate_url]
|
14 | [![npm Version][bd_npm_shield_url]][bd_npm_url]
|
15 |
|
16 | [bd_repo_url]: https://github.com/okunishinishi/node-writeout
|
17 | [bd_travis_url]: http://travis-ci.org/okunishinishi/node-writeout
|
18 | [bd_travis_shield_url]: http://img.shields.io/travis/okunishinishi/node-writeout.svg?style=flat
|
19 | [bd_travis_com_url]: http://travis-ci.com/okunishinishi/node-writeout
|
20 | [bd_travis_com_shield_url]: https://api.travis-ci.com/okunishinishi/node-writeout.svg?token=
|
21 | [bd_license_url]: https://github.com/okunishinishi/node-writeout/blob/master/LICENSE
|
22 | [bd_codeclimate_url]: http://codeclimate.com/github/okunishinishi/node-writeout
|
23 | [bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/okunishinishi/node-writeout.svg?style=flat
|
24 | [bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/okunishinishi/node-writeout.svg?style=flat
|
25 | [bd_gemnasium_url]: https://gemnasium.com/okunishinishi/node-writeout
|
26 | [bd_gemnasium_shield_url]: https://gemnasium.com/okunishinishi/node-writeout.svg
|
27 | [bd_npm_url]: http://www.npmjs.org/package/writeout
|
28 | [bd_npm_shield_url]: http://img.shields.io/npm/v/writeout.svg?style=flat
|
29 | [bd_standard_url]: http://standardjs.com/
|
30 | [bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | <a name="description"></a>
|
37 |
|
38 | Write out string files with various options.
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | <a name="sections"></a>
|
47 |
|
48 |
|
49 |
|
50 | <a name="section-doc-guides-01-installation-md"></a>
|
51 |
|
52 | Installation
|
53 | -----
|
54 |
|
55 | ```bash
|
56 | npm install writeout --save
|
57 | ```
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 | <a name="section-doc-guides-02-usage-md"></a>
|
65 |
|
66 | Usage
|
67 | ----
|
68 |
|
69 | ```javascript
|
70 | 'use strict'
|
71 |
|
72 | const writeout = require('writeout')
|
73 |
|
74 | // Generate a file.
|
75 | writeout('hello-wold', 'This is the contents text', {
|
76 | mkdirp: true,
|
77 | skipIfIdentical: true
|
78 | }).then((result) => {
|
79 | if (!result.skipped) {
|
80 | console.log('File generated:', result.filename)
|
81 | }
|
82 | }).catch((err) =>
|
83 | console.error(err)
|
84 | )
|
85 |
|
86 |
|
87 | ```
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 | <a name="section-doc-guides-03-options-md"></a>
|
94 |
|
95 | Options
|
96 | -----
|
97 |
|
98 | | Name | Default | Description |
|
99 | | --- | --- | --- |
|
100 | | `mkdirp` | false | Make parent directories. |
|
101 | | `skipIfIdentical` | false | Skip to write if existing content is identical. ||
|
102 | | `mode` | "644" | File permission. |
|
103 | | `force` | false | Force to write even if existing file is readonly. |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 | <a name="license"></a>
|
113 |
|
114 | License
|
115 | -------
|
116 | This software is released under the [MIT License](https://github.com/okunishinishi/node-writeout/blob/master/LICENSE).
|
117 |
|
118 |
|
119 |
|
120 |
|