1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00
denoland-deno/cli/js/write_text_file.ts

21 lines
588 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);
}