summaryrefslogtreecommitdiff
path: root/js/copy_file.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-08-26 16:18:42 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-08-26 10:18:42 -0400
commita6f6209f5277f2737bc67efad5c91ab168aff6b5 (patch)
tree88e8449e61e09cf5037def8d723ec43654d31b06 /js/copy_file.ts
parent520f9631e09aa720fd8c03513ee8ea967f5ed4b2 (diff)
port fs ops to JSON (#2812)
Diffstat (limited to 'js/copy_file.ts')
-rw-r--r--js/copy_file.ts18
1 files changed, 4 insertions, 14 deletions
diff --git a/js/copy_file.ts b/js/copy_file.ts
index 4c62ed1b0..b299a52bc 100644
--- a/js/copy_file.ts
+++ b/js/copy_file.ts
@@ -1,16 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync, msg, flatbuffers } from "./dispatch_flatbuffers";
-
-function req(
- from: string,
- to: string
-): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] {
- const builder = flatbuffers.createBuilder();
- const from_ = builder.createString(from);
- const to_ = builder.createString(to);
- const inner = msg.CopyFile.createCopyFile(builder, from_, to_);
- return [builder, msg.Any.CopyFile, inner];
-}
+import { sendSync, sendAsync } from "./dispatch_json";
+import * as dispatch from "./dispatch";
/** Copies the contents of a file to another by name synchronously.
* Creates a new file if target does not exists, and if target exists,
@@ -22,7 +12,7 @@ function req(
* Deno.copyFileSync("from.txt", "to.txt");
*/
export function copyFileSync(from: string, to: string): void {
- sendSync(...req(from, to));
+ sendSync(dispatch.OP_COPY_FILE, { from, to });
}
/** Copies the contents of a file to another by name.
@@ -36,5 +26,5 @@ export function copyFileSync(from: string, to: string): void {
* await Deno.copyFile("from.txt", "to.txt");
*/
export async function copyFile(from: string, to: string): Promise<void> {
- await sendAsync(...req(from, to));
+ await sendAsync(dispatch.OP_COPY_FILE, { from, to });
}