Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. # write [![NPM version](https://badge.fury.io/js/write.svg)](http://badge.fury.io/js/write) [![Build Status](https://travis-ci.org/jonschlinkert/write.svg)](https://travis-ci.org/jonschlinkert/write)
  2. > Write files to disk, creating intermediate directories if they don't exist.
  3. Install with [npm](https://www.npmjs.com/)
  4. ```sh
  5. $ npm i write --save
  6. ```
  7. ## API docs
  8. ### [writeFile](index.js#L32)
  9. Asynchronously write a file to disk. Creates any intermediate directories if they don't already exist.
  10. **Params**
  11. * `dest` **{String}**: Destination file path
  12. * `str` **{String}**: String to write to disk.
  13. * `callback` **{Function}**
  14. **Example**
  15. ```js
  16. var writeFile = require('write');
  17. writeFile('foo.txt', 'This is content to write.', function(err) {
  18. if (err) console.log(err);
  19. });
  20. ```
  21. ### [.writeFile.sync](index.js#L64)
  22. Synchronously write files to disk. Creates any intermediate directories if they don't already exist.
  23. **Params**
  24. * `dest` **{String}**: Destination file path
  25. * `str` **{String}**: String to write to disk.
  26. **Example**
  27. ```js
  28. var writeFile = require('write');
  29. writeFile.sync('foo.txt', 'This is content to write.');
  30. ```
  31. ### [.writeFile.stream](index.js#L87)
  32. Uses `fs.createWriteStream`, but also creates any intermediate directories if they don't already exist.
  33. **Params**
  34. * `dest` **{String}**: Destination file path
  35. * `returns` **{Stream}**: Returns a write stream.
  36. **Example**
  37. ```js
  38. var write = require('write');
  39. write.stream('foo.txt');
  40. ```
  41. ## Related
  42. * [delete](https://github.com/jonschlinkert/delete): Delete files and folders and any intermediate directories if they exist (sync and async).
  43. * [read-yaml](https://github.com/jonschlinkert/read-yaml): Very thin wrapper around js-yaml for directly reading in YAML files.
  44. * [read-json](https://github.com/azer/read-json): Reads and parses a JSON file.
  45. * [read-data](https://github.com/jonschlinkert/read-data): Read JSON or YAML files.
  46. * [write-yaml](https://github.com/jonschlinkert/write-yaml): Write YAML. Converts JSON to YAML writes it to the specified file.
  47. * [write-json](https://github.com/jonschlinkert/write-json): Write a JSON to file disk, also creates directories in the dest path if they… [more](https://github.com/jonschlinkert/write-json)
  48. ## Running tests
  49. Install dev dependencies:
  50. ```sh
  51. $ npm i -d && npm test
  52. ```
  53. ## Contributing
  54. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/write/issues/new)
  55. ## Author
  56. **Jon Schlinkert**
  57. + [github/jonschlinkert](https://github.com/jonschlinkert)
  58. + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
  59. ## License
  60. Copyright © 2015 Jon Schlinkert
  61. Released under the MIT license.
  62. ***
  63. _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 29, 2015._
  64. <!-- deps:mocha -->