Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

promisify

const util = require('util');
const fs = require('fs');

const stat = util.promisify(fs.stat);
stat('.').then((stats) => {
  // Do something with `stats`
}).catch((error) => {
  // Handle the error.
});
Source by nodejs.org #
 
PREVIOUS NEXT
Tagged: #promisify
ADD COMMENT
Topic
Name
5+9 =