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: implement glob, cp, opendir and other methods #86

Open
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

srghma
Copy link

@srghma srghma commented Oct 4, 2024

Description of the change

implement #82 (comment)

but not watchfiles

used this to play in js

var fs = require('fs').promises;
var path = require('path');
var dir = await fs.opendir(
  '/home/srghma/projects/purescript-tidy-codegen/src',
  {
    // encoding: 'buffer',
    encoding: 'ascii',
    recursive: true
  }
);
console.log(dir);
console.log(dir.readSync());

for await (var dirent of dir) {
  console.log('await', dirent);
}
// var dir = await fs.glob(
//   '**/*.purs',
//   {
//     cwd: '/home/srghma/projects/purescript-tidy-codegen/src',
//     withFileTypes: false,
//     exclude: (x) => console.log('filter', x)
//   }
// );
//
//
// var dir = await fs.readdir(
//   '/home/srghma/projects/purescript-tidy-codegen/src',
//   {
//     encoding: 'buffer',
//     withFileTypes: true,
//     recursive: false
//   }
// );
// 

Checklist:

  • Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0000)")
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation
  • Added a test for the contribution (if applicable)

@srghma srghma mentioned this pull request Oct 4, 2024
@srghma
Copy link
Author

srghma commented Oct 6, 2024

I think done

@@ -34,7 +37,7 @@ foreign import copyFile_FICLONE :: CopyMode
-- | If present, the copy operation will attempt to create a copy-on-write reflink. If the underlying platform does not support copy-on-write, then the operation will fail with an error.
foreign import copyFile_FICLONE_FORCE :: CopyMode

defaultCopyMode = copyFile_EXCL :: CopyMode
defaultCopyMode = copyFile_NO_FLAGS :: CopyMode
Copy link

Choose a reason for hiding this comment

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

I don't think this is a good default, overwriting should be opt-in since it's more dangerous.

Suggested change
defaultCopyMode = copyFile_NO_FLAGS :: CopyMode
defaultCopyMode = copyFile_EXCL :: CopyMode

Copy link
Author

Choose a reason for hiding this comment

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

but it is the default option by nodejs documentation

#81 (comment)

Copy link
Author

Choose a reason for hiding this comment

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

@i-am-the-slime
Copy link

Why is the watch API commented out here?

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

Successfully merging this pull request may close these issues.

3 participants