• I do not seem to be able to read a file after opening it - what am I doing wrong?

    const Storage = require('Storage');
      function compareFileWith (expectedContent) {
        if (''+Storage.read('4testing') !== expectedContent) {
          print('>>>> file does not look as expected');
          print('>>>> expected "' + expectedContent + '"');
          print('>>>> got "' + Storage.read('4testing') + '"');
        }
      }
    
    /**** 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!');
    
      let TestFile;
    
    /**** read file ****/
    
      TestFile = Storage.open('4testing','r');
    
      let readText = TestFile.read(4);
      if (readText !== 'Hello') {
        print('>>>> reading "4testing" failed');
        print('>>>> expected "Hello", got "' + readText + '"');
      }
    

    readText turns out to be undefined

About