Skip to content
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

Consider implementing cp / mv via FFI #458

Open
RaitoBezarius opened this issue Jan 15, 2024 · 2 comments
Open

Consider implementing cp / mv via FFI #458

RaitoBezarius opened this issue Jan 15, 2024 · 2 comments

Comments

@RaitoBezarius
Copy link

Hi there, foremost, thank you for your library, I am using your library for file manipulations and I just noticed that it fallbacks to cp / mv on UNIX systems, unfortunately, I don't have those binaries on the target system, therefore, I'm kind of stuck to perform the move operation.

Would you consider using FFI to perform atomic renames or copy here?

@alerque
Copy link
Member

alerque commented Jan 15, 2024

Did you try os.rename() for move? I'm not sure why we'd re-implement that.

For copy you can already read and write files right?

Also note the FFI only applies to LuaJIT, so even adding an implementation that way may not cover your use case.

If there is some reason to provide a real implementation the more likely candidate would be to add this to LFS, not Penlight.

@RaitoBezarius
Copy link
Author

Did you try os.rename() for move? I'm not sure why we'd re-implement that.

This only works on the same filesystem? Not across filesystem, does it?

For copy you can already read and write files right?

Yes, but this is not realistic for large files and small memory size.

Also note the FFI only applies to LuaJIT, so even adding an implementation that way may not cover your use case.

If there is some reason to provide a real implementation the more likely candidate would be to add this to LFS, not Penlight.

Got it.

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

No branches or pull requests

2 participants