Implement and export as default a function that "promisifies" asynchronous functions with callbacks.
import promisify from '../promisify.js'; const readFile = promisify(fs.readFile); const writeFile = promisify(fs.writeFile); const filepath = '/tmp/myfile'; writeFile(filepath, 'content') .then(() => readFile(filepath)) .then(console.log);
When implementing asynchronous functions, remember that the callback is always passed by the last parameter.
- Use rest and spread operatores
For full access to the challenge you need a professional subscription.
A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.
hours of theory