Skip to content

Instantly share code, notes, and snippets.

@jonalter
Created March 19, 2011 01:04
Show Gist options
  • Save jonalter/877108 to your computer and use it in GitHub Desktop.
Save jonalter/877108 to your computer and use it in GitHub Desktop.
Filesystem MODE_APPEND
var f = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'text.txt');
Ti.API.info('file = ' + f);
var contents = f.read();
Ti.API.info('exists = ' + f.exists());
Ti.API.info("contents blob object = "+contents);
Ti.API.info('contents = ' + contents.text);
var newFile = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'newfile.txt');
Ti.API.info('mode: '+ Ti.Filesystem.MODE_APPEND);
newFile.write(f.read());
newFile.write('line 5555');
Ti.API.info('newfile: '+newFile.read());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment