JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8563582
  • Score
    100M100P100Q198702F
  • License MIT

Write files to disk, creating intermediate directories if they don't exist.

Package Exports

  • write

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (write) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

write NPM version Build Status

Write files to disk, creating intermediate directories if they don't exist.

Install

Install with npm:

$ npm install write --save

Usage

var writeFile = require('write');

API

writeFile

Asynchronously write a file to disk, creating any intermediate directories along the way if they don't already exist.

Params

  • dest {String}: Destination file path
  • str {String}: String to write to disk.
  • callback {Function}

Example

var writeFile = require('write');
writeFile('foo.txt', 'This is content to write.', function(err) {
  if (err) console.log(err);
});

.writeFile.sync

Synchronously write files to disk, creating any intermediate directories along the way if they don't already exist.

Params

  • dest {String}: Destination file path
  • str {String}: String to write to disk.

Example

var writeFile = require('write');
writeFile.sync('foo.txt', 'This is content to write.');

.writeFile.stream

Uses fs.createWriteStream, but also creates any intermediate directories along the way if they don't already exist.

Params

  • dest {String}: Destination file path
  • returns {Stream}: Returns a write stream.

Example

var writeFile = require('write');
writeFile.stream('foo.txt');

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

Generate readme and API documentation with verb:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016 Jon Schlinkert Released under the MIT license.


This file was generated by verb, v0.9.0, on March 09, 2016.