Skip to content

FileManager.readFileContents

Kerri Shotts edited this page Oct 26, 2013 · 2 revisions

(part of FileManager)

Parameters:

  • filename - an absolute or relative path to the file (including the name)
  • options - an object representing the create and exclusive options
  • filetype - the type of file (and how to read it). See FILETYPE.

Returns: Promise, resolving to the contents of the file

ASYNCHRONOUS

Reads the file contents of filename, using the options object to create the file, treating it as a specific filetype.

options can look this to create a file or directory:

{
  create: true, // or false to not create
  exclusive: false // or true to fail if the file already exists when create is true
}

Usage

aFileManager.readFileContents ( "/path/to/file.txt", {}, aFileManager.FILETYPE.TEXT )
            .then ( function ( theContents ) { console.log (theContents); } )
            .catch ( function ( e ) { console.log ( e ); }
            .done ();
Clone this wiki locally