API Docs for: 0.3.0
Show:

FileWriter Class

Extends Writer
Module: io

a concrete writer implementation that can write files synchronously or asynchronously based on the constructor argument passed to it.

Usage

 var sync = true,
     fileWriter = new require('istanbul').FileWriter(sync);

 fileWriter.on('done', function () { console.log('done'); });
 fileWriter.copyFile('/foo/bar.jpg', '/baz/bar.jpg');
 fileWriter.writeFile('/foo/index.html', function (contentWriter) {
     contentWriter.println('<html>');
     contentWriter.println('</html>');
 });
 fileWriter.done(); // will emit the done event when all files are written

Constructor

FileWriter

(
  • sync
)

Parameters:

  • sync Object

Item Index

Methods

copyFile

(
  • source
  • dest
)

Inherited from Writer: lib/util/writer.js:68

copies a file from source to destination

Parameters:

  • source String

    the file to copy, found on the file system

  • dest String

    the destination path

done

()

Inherited from Writer: lib/util/writer.js:77

marker method to indicate that the caller is done with this writer object The writer is expected to emit a done event only after this method is called and it is truly done.

writeFile

(
  • file
  • callback
)

Inherited from Writer: lib/util/writer.js:59

allows writing content to a file using a callback that is passed a content writer

Parameters:

  • file String

    the name of the file to write

  • callback Function

    the callback that is called as callback(contentWriter)