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?
@Andreas_Rozek started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Good morning!
I still have my problems working with StorageFiles.
When I try
I only get the following output
Thus, how can I create a new file if I must not mix Storage methods with StorageFile ones?