From 818a8010928cb8cef0b7043bd881c8cdce9b6efc Mon Sep 17 00:00:00 2001 From: River <22485304+actual-size@users.noreply.github.com> Date: Fri, 12 Jun 2020 02:36:20 +1000 Subject: feat: URL support in Deno filesystem methods (#5990) --- cli/js/write_text_file.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cli/js/write_text_file.ts') diff --git a/cli/js/write_text_file.ts b/cli/js/write_text_file.ts index d2a6575d7..4f111edb4 100644 --- a/cli/js/write_text_file.ts +++ b/cli/js/write_text_file.ts @@ -1,7 +1,7 @@ import { open, openSync } from "./files.ts"; import { writeAll, writeAllSync } from "./buffer.ts"; -export function writeTextFileSync(path: string, data: string): void { +export function writeTextFileSync(path: string | URL, data: string): void { const file = openSync(path, { write: true, create: true, truncate: true }); const enc = new TextEncoder(); const contents = enc.encode(data); @@ -9,7 +9,10 @@ export function writeTextFileSync(path: string, data: string): void { file.close(); } -export async function writeTextFile(path: string, data: string): Promise { +export async function writeTextFile( + path: string | URL, + data: string +): Promise { const file = await open(path, { write: true, create: true, truncate: true }); const enc = new TextEncoder(); const contents = enc.encode(data); -- cgit v1.2.3