UNPKG

@pythagora.io/js-code-processing

Version:

This repository hosts the 'code-processing' npm package, which contains a set of code processing methods for generating tests.

20 lines (17 loc) 389 B
const fs = require("fs"); async function checkDirectoryExists(directoryPath) { try { const stats = await fs.promises.stat(directoryPath); return stats.isDirectory(); } catch (error) { if (error.code === "ENOENT") { // Directory does not exist return false; } // Other error occurred throw error; } } module.exports = { checkDirectoryExists };