kevinbeaty / fs-promise

[DEPRECATED] Use mz or fs-extra^3 with Promise support
https://www.npmjs.com/package/fs-extra
MIT License
170 stars 13 forks source link

What is "file" in example snippet #13

Closed vprasanth closed 8 years ago

vprasanth commented 8 years ago

Hey there, regarding this snippet from the README:

fsp.writeFile(file('hello1'), 'hello world')
  .then(function(){
    return fsp.readFile(file('hello1'), {encoding:'utf8'});
  })
  .then(function(contents){});

What is file? Sorry if this is ultra noob.

kevinbeaty commented 8 years ago

Sorry for the confusion, I must have copied the example from my tests. It's just a function that returns a file path as a string, e.g. '/tmp/hello1'.

All functions proxy either Node.js fs or fs-extra (in this case writeFile) directly only returning promises instead.