- // Ensures a directory exists.
-
- async _ensureDirectoryExists(directory) {
-
- internals.debuglog(`Checking if ${directory} exists.`);
- try {
- await access(directory);
- }
- catch (error) {
- if (error.code === internals.kFileNotFoundError) {
- internals.debuglog(`Creating ${directory}`);
- await mkdir(directory, { recursive: true });
- return;
- }
-
- throw error;
- }
- }
-
- // Ensures posts directory exists
-
- async _ensurePostsDirectoryExists() {
-
- return this._ensureDirectoryExists(this.postsDirectory);
- }
-