-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add copyFile/copyFileSync
(and remove unused fbs table WriteFileSync
)
#863
Conversation
copyFile/copyFileSync
(and remove unused fbs table WriteFileSync
)
Thanks io.Copy is not this function in Go. It doesn't exist in Go. I'm slightly concerned about adding it because of that fact. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hesitant to add this because Go doesn't have it - but I think it's useful functionality to have and your implementation is well tested and simple. LGTM (but please split the commit into two - see comment below)
src/msg.fbs
Outdated
perm: uint; | ||
// perm specified by https://godoc.org/os#FileMode | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch - thanks - can you remove this in a standalone commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- Improve fetch headers (denoland#853) - Add deno.truncate (denoland#805) - Add copyFile/copyFileSync (denoland#863) - Limit depth of output in console.log for nested objects, and add console.dir (denoland#826) - Guess extensions on extension not provided (denoland#859) - Renames: deno.platform -> deno.platform.os deno.arch -> deno.platform.arch - Upgrade TS to 3.0.3 - Add readDirSync(), readDir() - Add support for TCP servers and clients. (denoland#884) Adds deno.listen(), deno.dial(), deno.Listener and deno.Conn.
- Improve fetch headers (#853) - Add deno.truncate (#805) - Add copyFile/copyFileSync (#863) - Limit depth of output in console.log for nested objects, and add console.dir (#826) - Guess extensions on extension not provided (#859) - Renames: deno.platform -> deno.platform.os deno.arch -> deno.platform.arch - Upgrade TS to 3.0.3 - Add readDirSync(), readDir() - Add support for TCP servers and clients. (#884) Adds deno.listen(), deno.dial(), deno.Listener and deno.Conn.
Bumped versions for 0.302.0 Please ensure: - [x] Crate versions are bumped correctly To make edits to this PR: ```shell git fetch upstream release_0_302.0 && git checkout -b release_0_302.0 upstream/release_0_302.0 ``` cc @devsnek Co-authored-by: devsnek <devsnek@users.noreply.github.com>
What is in this PR
deno.copyFile(from, to)
anddeno.copyFileSync(from, to)
WriteFileSync
Implementation reference
io.Copy(to, from)
fs.copyFile(src, dest[, flags], callback)
std::fs::copy(from: P, to: Q)
FileUtils.copy_file(src, dest, preserve = false, dereference = true)
Details
Implemented
copyFile
since it is a handy call.An alternative implementation could have been done by using
deno.File
, open 2 files and docopy
between file descriptors, but would require multiple serialization/deserialization instead of once.Removed
table WriteFileSync { ... }
frommsg.fbs
since I could not found where it is used. It was introduced in #846, probably due to a rebase/merge error.