aboutsummaryrefslogtreecommitdiff
path: root/src/js/private.d.ts
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-08-30 18:30:06 -0700
committerGravatar GitHub <noreply@github.com> 2023-08-30 18:30:06 -0700
commit0a5d2a8195fbbaab7ff1f40ad54ba94726bcc104 (patch)
tree218b52f72b1170c8595800dcda34adc312adf08b /src/js/private.d.ts
parent89f24e66fff37eab4b984847b73be0b69dbcd0a8 (diff)
downloadbun-0a5d2a8195fbbaab7ff1f40ad54ba94726bcc104.tar.gz
bun-0a5d2a8195fbbaab7ff1f40ad54ba94726bcc104.tar.zst
bun-0a5d2a8195fbbaab7ff1f40ad54ba94726bcc104.zip
feat(node:fs): add `cp`/`cpSync`/`promises.cp` + async `copyFile` (#4340)
* half working disaster code * this * async copyFile * . * its failing symlink tests * asdfg * asdf * hmm * okay i think ti works * small edits * fix test on linux * i hate atomics / atomics hate me back <3 * add a message in the builtins bundler that 0.8 is needed. it breaks on older versions lol. * fixed * rebase
Diffstat (limited to '')
-rw-r--r--src/js/private.d.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/js/private.d.ts b/src/js/private.d.ts
index 854d07c2e..80c22bd51 100644
--- a/src/js/private.d.ts
+++ b/src/js/private.d.ts
@@ -27,7 +27,7 @@ interface BunFSWatcher {
*/
unref(): void;
}
-type BunFS = Omit<typeof import("node:fs"), "watch"> & {
+type BunFS = Omit<typeof import("node:fs") & typeof import("node:fs/promises"), "watch" | "cp" | "cpSync"> & {
/**
* Watch for changes on `filename`, where `filename` is either a file or a
* directory.
@@ -87,6 +87,18 @@ type BunFS = Omit<typeof import("node:fs"), "watch"> & {
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
*/
watch(filename: string, listener?: BunWatchListener<string>): BunFSWatcher;
+
+ // internal api is for fs.cp and fs.cpSync that is limited to a few options.
+ // there is a js implementation for options like `filter` in `src/js/internal/fs/cp*`
+ cpSync(
+ source: string,
+ dest: string,
+ recursive?: boolean,
+ errorOnExist?: boolean,
+ force?: boolean,
+ mode?: number,
+ ): void;
+ cp(source: string, dest: string, recursive?: boolean, errorOnExist?: boolean, force?: boolean, mode?: number): void;
};
declare module "bun" {