8000 feat(toFile): the situation where compatible paths cannot exist by fanxinqi · Pull Request #84 · huan/file-box · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(toFile): the situation where compatible paths cannot exist #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fanxinqi
Copy link
@fanxinqi fanxinqi commented Mar 6, 2024

If the path cannot exist, create the path
If there is a path, follow the original logic normally

8000

If the path cannot exist, create the path
If there is a path, follow the original logic normally
Copy link
Owner
@huan huan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please modify code as requested.

And,

  1. please add a param comment (jsdoc) to the overwrite parameter to explain the new feature.
  2. please add an unit test to test this new feature.

// Check if file exists
let exist = false;
try {
FS.accessSync(fullFilePath);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use async instead of sync, with await, please

// Create directory if it doesn't exist
const directory = PATH.dirname(fullFilePath);
if (!FS.existsSync(directory)) {
FS.mkdirSync(directory, { recursive: true });
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only do the mkdir if the overwrite is true

@huan huan requested a review from Copilot April 13, 2025 06:46
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

src/file-box.ts:903

  • [nitpick] Consider renaming the variable 'exist' to 'exists' to better reflect that it represents a boolean value, which would improve clarity.
let exist = false;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0