UNPKG

3.25 kBMarkdownView Raw
1writeout
2==========
3
4<!---
5This file is generated by ape-tmpl. Do not update manually.
6--->
7
8<!-- Badge Start -->
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<!-- Badge End -->
33
34
35<!-- Description Start -->
36<a name="description"></a>
37
38Write out string files with various options.
39
40<!-- Description End -->
41
42
43
44
45<!-- Sections Start -->
46<a name="sections"></a>
47
48<!-- Section from "doc/guides/01.Installation.md.hbs" Start -->
49
50<a name="section-doc-guides-01-installation-md"></a>
51
52Installation
53-----
54
55```bash
56npm install writeout --save
57```
58
59
60<!-- Section from "doc/guides/01.Installation.md.hbs" End -->
61
62<!-- Section from "doc/guides/02.Usage.md.hbs" Start -->
63
64<a name="section-doc-guides-02-usage-md"></a>
65
66Usage
67----
68
69```javascript
70'use strict'
71
72const writeout = require('writeout')
73
74// Generate a file.
75writeout('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<!-- Section from "doc/guides/02.Usage.md.hbs" End -->
90
91<!-- Section from "doc/guides/03.Options.md.hbs" Start -->
92
93<a name="section-doc-guides-03-options-md"></a>
94
95Options
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<!-- Section from "doc/guides/03.Options.md.hbs" End -->
106
107
108<!-- Sections Start -->
109
110
111<!-- LICENSE Start -->
112<a name="license"></a>
113
114License
115-------
116This software is released under the [MIT License](https://github.com/okunishinishi/node-writeout/blob/master/LICENSE).
117
118<!-- LICENSE End -->
119
120