Guest User

Untitled

a guest
Jan 23rd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. // This is a test harness for your module
  2. // You should do something interesting in this harness
  3. // to test out the module and to provide instructions
  4. // to users on how to use it by example.
  5.  
  6.  
  7. // open a single window
  8. var window = Ti.UI.createWindow({
  9. backgroundColor:'white'
  10. });
  11. var label = Ti.UI.createLabel();
  12. window.add(label);
  13. window.open();
  14.  
  15. // TODO: write your module tests here
  16. var utils = require('com.clearlyinnovative.utils');
  17. Ti.API.info("module is => " + utils);
  18.  
  19. var f = Ti.Filesystem.getFile("allgood.png");
  20. Ti.API.info(utils.base64encode( f.read() ));
  21. var encoded_string = utils.base64encode( f.read() );
  22.  
  23.  
  24. var newDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'mydir');
  25. Ti.API.info("Created mydir: " + newDir.createDirectory());
  26. Ti.API.info('newdir ' + newDir.nativePath);
  27. var newFile = Titanium.Filesystem.getFile(newDir.nativePath,'newfile.png');
  28. newFile.write(Ti.Utils.base64decode(encoded_string));
Add Comment
Please, Sign In to add comment