B2G/gecko/toolkit/mozapps/update/test/shared.js
/**
 * Writes text to a file. This will replace existing text if the file exists
 * and create the file if it doesn't exist.
 *
 * @param  aFile
 *         The file to write to. Will be created if it doesn't exist.
 * @param  aText
 *         The text to write to the file. If there is existing text it will be
 *         replaced.
 */
Writes text to a file. This will replace existing text if the file exists
and create the file if it doesn't exist.

@param  aFile
The file to write to. Will be created if it doesn't exist.
@param  aText
The text to write to the file. If there is existing text it will be
replaced.
Writes text to a file . This will replace existing text if the file exists and create the file if it doesn ' t exist . @param aFile The file to write to . Will be created if it doesn ' t exist . @param aText The text to write to the file . If there is existing text it will be replaced .
function writeFile(aFile, aText) {
  var fos = AUS_Cc["@mozilla.org/network/file-output-stream;1"].
            createInstance(AUS_Ci.nsIFileOutputStream);
  if (!aFile.exists())
    aFile.create(AUS_Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
  fos.init(aFile, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE, PERMS_FILE, 0);
  fos.write(aText, aText.length);
  fos.close();
}
function writeFile ( aFile , aText ) { var fos = AUS_Cc [ "@mozilla.org/network/file-output-stream;1" ] . createInstance ( AUS_Ci . nsIFileOutputStream ) ; if ( ! aFile . exists ( ) ) aFile . create ( AUS_Ci . nsILocalFile . NORMAL_FILE_TYPE , PERMS_FILE ) ; fos . init ( aFile , MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE , PERMS_FILE , 0 ) ; fos . write ( aText , aText . length ) ; fos . close ( ) ; }
Writes text to a file.
Writes text to a file .