November 2019
Beginner
436 pages
8h 52m
English
In this section, we are going to save the markdown into a temporary file. Follow these steps to do so:
const os = require('os');const path = require('path');
function writeTempFile(contents, callback) { const tempPath = path.join(os.tmpdir(), 'markdown'); fs.mkdtemp(tempPath, (err, folderName) => { const filePath = path.join(folderName, 'markdown.md'); fs.writeFile(filePath, contents, 'utf8', () => { callback(filePath); }); });}
Read now
Unlock full access