• Good morning!

    I still have my problems working with StorageFiles.

    When I try

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

    I only get the following output

    file "4testing" could not be created
    >>>> file does not look as expected
    >>>> expected "Hello, World!"
    >>>> got "undefined"
    finished
    

    Thus, how can I create a new file if I must not mix Storage methods with StorageFile ones?

About