1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-28 10:09:20 -05:00
denoland-deno/cli/js/write_text_file.ts
2020-07-14 15:24:17 -04:00

20 lines
590 B
TypeScript

// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { writeFileSync, writeFile, WriteFileOptions } from "./write_file.ts";
export function writeTextFileSync(
path: string | URL,
data: string,
options: WriteFileOptions = {},
): void {
const encoder = new TextEncoder();
return writeFileSync(path, encoder.encode(data), options);
}
export function writeTextFile(
path: string | URL,
data: string,
options: WriteFileOptions = {},
): Promise<void> {
const encoder = new TextEncoder();
return writeFile(path, encoder.encode(data), options);
}