24 lines
264 B
JavaScript
24 lines
264 B
JavaScript
const fs = require('fs').promises;
|
|
|
|
|
|
class AsyncFs
|
|
{
|
|
static create = () => new this();
|
|
|
|
|
|
async exists(path)
|
|
{
|
|
try
|
|
{
|
|
await fs.access(path);
|
|
return true;
|
|
}
|
|
catch
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
module.exports = AsyncFs; |