1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-02 12:28:46 -05:00
denoland-deno/cli/js/write_text_file.ts

21 lines
590 B
TypeScript
Raw Normal View History

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