2020-07-06 21:45:39 -04:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-07-08 09:38:22 -04:00
|
|
|
import { writeFileSync, writeFile, WriteFileOptions } from "./write_file.ts";
|
2020-07-06 21:45:39 -04:00
|
|
|
|
2020-07-08 09:38:22 -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();
|
2020-07-08 09:38:22 -04:00
|
|
|
return writeFileSync(path, encoder.encode(data), options);
|
2020-04-28 01:35:20 -04:00
|
|
|
}
|
|
|
|
|
2020-07-08 09:38:22 -04:00
|
|
|
export function writeTextFile(
|
2020-06-11 12:36:20 -04:00
|
|
|
path: string | URL,
|
2020-07-08 09:38:22 -04:00
|
|
|
data: string,
|
|
|
|
options: WriteFileOptions = {}
|
2020-06-11 12:36:20 -04:00
|
|
|
): Promise<void> {
|
2020-07-06 21:45:39 -04:00
|
|
|
const encoder = new TextEncoder();
|
2020-07-08 09:38:22 -04:00
|
|
|
return writeFile(path, encoder.encode(data), options);
|
2020-04-28 01:35:20 -04:00
|
|
|
}
|