writeout

Write out string files with various options.

Usage no npm install needed!

<script type="module">
  import writeout from 'https://cdn.skypack.dev/writeout';
</script>

README

writeout

Build Status Code Climate Code Coverage npm Version

Write out string files with various options.

Installation

npm install writeout --save

Usage

'use strict'

const writeout = require('writeout')

// Generate a file.
writeout('hello-wold', 'This is the contents text', {
  mkdirp: true,
  skipIfIdentical: true
}).then((result) => {
  if (!result.skipped) {
    console.log('File generated:', result.filename)
  }
}).catch((err) =>
  console.error(err)
)


Options

Name Default Description
mkdirp false Make parent directories.
skipIfIdentical false Skip to write if existing content is identical.
mode "644" File permission.
force false Force to write even if existing file is readonly.

License

This software is released under the MIT License.