Skip to content

Commit

Permalink
Rename checkFileExists in checkPathAccessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
343dev committed Sep 28, 2024
1 parent fba685e commit 1e5f4c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
import { access } from 'node:fs/promises';

export default async function checkFileExists(filePath) {
export async function checkPathAccessibility(filePath) {
try {
await access(filePath);
return true;
Expand Down
6 changes: 3 additions & 3 deletions lib/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 8,7 @@ import pLimit from 'p-limit';
import sharp from 'sharp';

import { calculateRatio } from './calculate-ratio.js';
import checkFileExists from './check-file-exists.js';
import { checkPathAccessibility } from './check-path-accessibility.js';
import createProgressBarContainer from './create-progress-bar-container.js';
import { SUPPORTED_FILE_TYPES } from './constants.js';
import formatBytes from './format-bytes.js';
Expand Down Expand Up @@ -127,9 127,9 @@ async function processFile({
const outputFilePath = path.join(dir, `${name}.${format.toLowerCase()}`);
const preparedOutputFilePath = prepareWriteFilePath(outputFilePath, outputDirectoryPath);

const isFileExists = await checkFileExists(preparedOutputFilePath);
const isAccessible = await checkPathAccessibility(preparedOutputFilePath);

if (!isForced && isFileExists) {
if (!isForced && isAccessible) {
logProgressVerbose(preparedOutputFilePath, {
description: `File already exists, '${preparedOutputFilePath}'`,
progressBarContainer,
Expand Down

0 comments on commit 1e5f4c3

Please sign in to comment.