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