• Hello again,

    it might not be related to my previous post which is why I created another one.

    StorageFile.read() seems to always expect a length argument - but how do I then read a whole file? there is no size method?

    But there is another problem: when I try

    const Storage = require('Storage');
      function compareFileWith (expectedContent) {
        let readText = Storage.open('4testing','r').read(1000);­
        if (readText != expectedContent) {
          print('>>>> file does not look as expected');
          print('>>>> expected "' + expectedContent + '"');
          print('>>>> got "' + readText + '"');
        }
      }
    
    /**** create file ****/
    
      if (Storage.write('4testing','Hello, World!')) {
        print('file "4testing" was successfully created');
      } else {
        print('file "4testing" could not be created');
      }
      compareFileWith('Hello, World!');
    print('finished');
    

    the file "4testing" is successfully created - but reading it using StorageFile.read produces a strange result:

    file "4testing" was successfully created
    >>>> file does not look as expected
    >>>> expected "Hello, World!"
    >>>> got "4testing4testing4testing"
    finished
    

    What am I doing wrong?

    BTW: I am using the "cutting edge" distribution of today

About