filer icon indicating copy to clipboard operation
filer copied to clipboard

Testing opening and writing to a file using promise based API

Open dnguneratne opened this issue 7 years ago • 1 comments

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.

dnguneratne avatar Sep 17 '18 14:09 dnguneratne

Assigning to you @dnguneratne. Put your new promises test in the same file for now.

humphd avatar Sep 17 '18 20:09 humphd