filer
filer copied to clipboard
Testing opening and writing to a file using promise based API
const fs = new Filer.FileSystem().promises;
fs.open('/myfile', 'w+')
.then(fd => fs.close(fd))
.then(() => fs.stat('/myfile'))
.then(stats => { console.log(`stats: ${JSON.stringify(stats)}`); })
.catch(err => { console.error(err); })
I'd like to write a test for the above example in the readme file. Since the file was opened for writing, I'd like to test writing to the file as well.
The test would check if the file was opened, successfully edited, closed, and whether the expected file information was returned.
Assigning to you @dnguneratne. Put your new promises test in the same file for now.