Node.js ã®ã³ã¢ã« util.promisify ã追å ãããã github.com ä»å㯠util.promisify ãæã¤å½¹å²ãä¸å¿ã« Node.js ã«ããã Promise ã®ç«å ´ã«ã¤ãã¦ã話ãã¦ãããã¨ããã¨æãã util.promisify ã¨ã¯ èªãã§åã®ãã¨ãé¢æ°ã Promise ã«å¤æãã¦ãããã¦ã¼ãã£ãªãã£ã¡ã½ããã ä¸è¨ã®ãããªè¦é ã§å¤æã§ããã const util = require('util'); const fs = require('fs'); const stat = util.promisify(fs.stat); stat('.').then((stats) => { console.log(stats); }).catch((error) => { console.error(error); }); async-awaitã使ããã
{{#tags}}- {{label}}
{{/tags}}