-
Notifications
You must be signed in to change notification settings - Fork 17
Filemanager.writefilecontents
Chase Noel edited this page Jun 5, 2014
·
2 revisions
(part of FileManager)
Parameters:
-
filename
- an absolute or relative path to the file (including filename) -
options
- an object representing thecreate
andexclusive
options -
data
- the data to write
Returns: Promise, resolving to the FileManager
ASYNCHRONOUS
Writes the specified data
to the specified file represented by filename
, using the options
to create it (if specified). The file type will be based on the type of data
.
options
can look this to create a directory:
{
create: true, // or false to not create
exclusive: false // or true to fail if the file already exists when create is true
}
aFileManager.writeFileContents ( "/path/to/file.txt", { create: true, exclusive: false},
new Blob ( ["the file contents"], {type:"text/plain"} ) )
.then ( ... )
.catch ( function ( e ) { console.log ( e ); }
.done ();
Note: On Chrome, it is important to pass a Blob
object when writing a text file.