Skip to content

feat: add fs/append-file #1967

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

Merged
merged 24 commits into from
May 18, 2024

Conversation

HRIDYANSHU054
Copy link
Contributor

@HRIDYANSHU054 HRIDYANSHU054 commented Mar 20, 2024

adds file system append file utility to Stdlib

Description

What is the purpose of this pull request?
This pull request brings the node js file system append-file utility to Stdlib

This pull request:

is aligned with the purpose of achievinng feature parity with Node.js fs package. It Brings file system's powerful append file utility to Stdlib expanding its existing fs utilities.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Implementation details

-- async version

var join = require("path").join;

var fpath = join(__dirname, "examples", "fixtures", "file.txt");

appendFile(fpath, "beep boop\n", onAppend);

function onAppend(error) {
  if (error) {
    throw error;
  }
}

-- sync version

var appendFile = require( '@stdlib/fs/append-file' );

// Explicitly handle the error...
var err = appendFile( './beep/boop.txt', 'data to append\n' );
if ( err instanceof Error ) {
     throw err;
}

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

Copy link
Contributor

@stdlib-bot stdlib-bot left a comment

Choose a reason for hiding this comment

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

👋 Hi there! 👋

And thank you for opening your first pull request! We will review it shortly. 🏃 💨

@kgryte kgryte changed the title added append-file utility in stdlib/fs feat: add append-file utility in stdlib/fs Mar 20, 2024
@kgryte kgryte changed the title feat: add append-file utility in stdlib/fs feat: add fs/append-file Mar 20, 2024
@kgryte
Copy link
Member

kgryte commented Mar 20, 2024

/stdlib update-copyright-years

@kgryte kgryte added Feature Issue or pull request for adding a new feature. Needs Review A pull request which needs code review. Utilities Issue or pull request concerning general utilities. Needs Changes Pull request which needs changes before being merged. labels Mar 20, 2024
@kgryte
Copy link
Member

kgryte commented Mar 20, 2024

Thanks, @HRIDYANSHU054, for working on this. This PR is currently failing CI. Those failures need to be addressed before the PR can be reviewed.

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Mar 20, 2024
@HRIDYANSHU054
Copy link
Contributor Author

Hi @kgryte , Thanks for checking this PR. I m currently working on solving these issues. Majority of them have arised because the fixtures directory was somehow not pushed to github.

Hridyanshu7 added 3 commits March 22, 2024 00:05
-> run_affected_benchmarks / Run affected benchmarks (pull_request)
-> run_affected_examples / Run changed examples (pull_request)
-> run_affected_tests / Run affected tests (pull_request)
@HRIDYANSHU054
Copy link
Contributor Author

HRIDYANSHU054 commented Mar 22, 2024

@kgryte can you please have a look, I have made changes to tackle the previous PR issues. Though this might seem a silly question but why is it stuck in "Expected — Waiting for status to be reported" , is there any workaround I could do to get it cleared

@HRIDYANSHU054
Copy link
Contributor Author

Corrected some more things. @kgryte can you once again check this

@HRIDYANSHU054
Copy link
Contributor Author

HRIDYANSHU054 commented Mar 23, 2024

@kgryte can you please approve the remaining workflows. I am interested in this and would like to tackle any other issue that arises or any change that is required.

- error  Begin description with `Append` instead of `Appends`  stdlib/jsdoc-main-export
- Expected space(s) after "catch".   keyword-spacing
- Unexpected sync method: 'appendFileSync'.   node/no-sync
@HRIDYANSHU054
Copy link
Contributor Author

@kgryte all the issues that have been highlighted thus far during the CI checks have been solved. Can you again approve the remaining workflows so that if there are any other errors then they could also be solved and this pr can thus be reviewed. On a sidenote really thanks for your patience✨.

- error  Unnecessary try/catch wrapper  no-useless-catch
- error  Missing JSDoc comment  require-jsdoc
@HRIDYANSHU054
Copy link
Contributor Author

@kgryte can you please have a look

@HRIDYANSHU054
Copy link
Contributor Author

@kgryte please check

@HRIDYANSHU054
Copy link
Contributor Author

@kgryte please rerun the CI

Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

@HRIDYANSHU054 I've left a number of initial comments. This implementation needs a fair amount of clean-up before it can be ready for merge.

@HRIDYANSHU054
Copy link
Contributor Author

@kgryte thanks for going through this and reviewing it. I don't why the splitting has happened in only some functions and not others even though I have configured my ESlint to highlight these issues if they occur. Also can I address this after 5th april as I am currenlty having fromm today my mid semester examinations.

Hridyanshu7 added 2 commits April 6, 2024 01:31
major changes
- approach for sync version chnaged from throwing errors to returing errors.
- approach for benchmarking, now the file is deleted after every itr and then created in the next itr by appendFile
@HRIDYANSHU054
Copy link
Contributor Author

@kgryte the changes you highlighted have been implemented, certain things like the new benchmarking approach strongly needs to be reviewed

@HRIDYANSHU054 HRIDYANSHU054 requested a review from kgryte April 5, 2024 20:45
@HRIDYANSHU054
Copy link
Contributor Author

@kgryte can you approve these remaining workflows and then review the changes

@HRIDYANSHU054
Copy link
Contributor Author

Hi ✋ @kgryte just hoping you could further review these changes, and anything more that you want me to change or add I will work on that also.

@HRIDYANSHU054
Copy link
Contributor Author

hi @kgryte could you review this

@HRIDYANSHU054
Copy link
Contributor Author

@kgryte could you review this PR

@Planeshifter Planeshifter self-requested a review May 8, 2024 19:41
Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

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

Apologies for the late review; thanks for your PR, which looks very good now. I will merge shortly after CI has passed again after some tiny changes.

…ror.js.txt

Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
…ror.js.txt

Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
@Planeshifter Planeshifter added Ready To Merge A pull request which is ready to be merged. and removed Needs Changes Pull request which needs changes before being merged. labels May 18, 2024
Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
@Planeshifter Planeshifter merged commit 14dda68 into stdlib-js:develop May 18, 2024
8 checks passed
@HRIDYANSHU054
Copy link
Contributor Author

Thanks @Planeshifter looking forward to learning and contribute more to stdlib node's environment

@HRIDYANSHU054 HRIDYANSHU054 deleted the added-fs/appendFile branch May 30, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Issue or pull request for adding a new feature. Ready To Merge A pull request which is ready to be merged. Utilities Issue or pull request concerning general utilities.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants