Support Atom v1.21. Remove Electron dependency. (#20282)

This commit is contained in:
Glen M
2017-10-04 09:25:09 -04:00
committed by Masahiro Wakame
parent a3f56c28fa
commit 601ac7b620
7 changed files with 133 additions and 35 deletions

View File

@@ -7,6 +7,8 @@
/// <reference types="node" />
/// <reference types="event-kit" />
import { ReadStream, WriteStream } from "fs";
declare global {
namespace PathWatcher {
/** Objects that appear as parameters to callbacks. */
@@ -128,13 +130,13 @@ declare global {
read(flushCache?: boolean): Promise<string>;
/** Returns a stream to read the content of the file. */
createReadStream(): NodeJS.ReadableStream;
createReadStream(): ReadStream;
/** Overwrites the file with the given text. */
write(text: string): Promise<undefined>;
/** Returns a stream to write content to the file. */
createWriteStream(): NodeJS.WritableStream;
createWriteStream(): WriteStream;
/** Overwrites the file with the given text. */
writeSync(text: string): undefined;

View File

@@ -59,7 +59,8 @@ async function readFile() {
str = await file.read();
}
file.createReadStream();
const stream = file.createReadStream();
stream.close();
async function writeFile() {
await file.write("Test");