Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(fs/unstable): add makeTempDir and makeTempDirSync #6391

Merged
merged 5 commits into from
Feb 12, 2025

Conversation

jbronder
Copy link
Contributor

@jbronder jbronder commented Feb 9, 2025

This PR adds the makeTempDir and makeTempDirSync APIs to the @std/fs package which intends to mirror the Deno.makeTempDir and Deno.makeTempDirSync functions. The PR also adds the MakeTempOptions type and helper functions getNodeOs and getNodePath in the _utils.ts file in preparation for use in future implementations of @std/fs APIs: makeTempFile and makeTempFileSync.

To achieve cross-runtime compatibility with Node.js and satisfy the Deno FS API requirement, the makeTempDir and makeTempDirSync APIs with MakeTempOptions extends functionality for creating temporary directories in Node.js. By adding an optional interface to augment the naming of temporary directory paths, these APIs exist as an alternative to Node-specific APIs that pass a prefix path string argument to mkdtemp or mkdtempSync to create temporary directories.

Towards #6255.

@jbronder jbronder requested a review from kt3k as a code owner February 9, 2025 06:58
@github-actions github-actions bot added the fs label Feb 9, 2025
Copy link

codecov bot commented Feb 9, 2025

Codecov Report

Attention: Patch coverage is 17.52577% with 80 lines in your changes missing coverage. Please review.

Project coverage is 96.11%. Comparing base (3b75ee7) to head (d36a48f).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
fs/unstable_make_temp_dir.ts 17.24% 72 Missing ⚠️
fs/_utils.ts 20.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6391      +/-   ##
==========================================
- Coverage   96.23%   96.11%   -0.12%     
==========================================
  Files         556      557       +1     
  Lines       42065    42156      +91     
  Branches     6371     6373       +2     
==========================================
+ Hits        40481    40519      +38     
- Misses       1544     1598      +54     
+ Partials       40       39       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

LGTM. Nice work!

@kt3k kt3k merged commit b7c76d5 into denoland:main Feb 12, 2025
18 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants