Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Tip: Use file.blob() instead of file.read()

A tip for those who are pulling their hair out reading the documentation and wondering why file.read() doesn't work.

file.blob() is what you need.

Please update the documentation with this simple change.

Thanks

Mark

— asked November 9th 2010 by Mark Poston
  • binary
  • blob
  • documentation
  • file
  • issue
  • read
  • system
0 Comments

2 Answers

  • var     f = Titanium.Filesystem.getFile('categories.csv');
    var read = f.blob();
    

    Throws an Exception "function blob not found"

    — answered November 10th 2010 by Carl Jahn
    permalink
    1 Comment
    • I have tried the following code, and it works fine:

      var f = Titanium.Filesystem.getFile('categories.csv');

      var read = f.read.blob;

      — commented March 16th 2011 by Paul Walsh
  • I think you missed a bit in your comment. Instead of:

    var read = f.blob();
    

    I have:

    var read = f.read.blob;
    

    and it works just fine. Thanks for pointing me in the right direction though.

    — answered March 16th 2011 by Paul Walsh
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.