Implement fs module (#3)

* Implements the fs module

* Add stats object

* Add not implemented to createWriteStream

* Update mkdtemp to use tmp dir

* Unexport Stats

* Add client web socket for commands and restructure
This commit is contained in:
Kyle Carberry
2019-01-14 14:58:34 -06:00
parent da27bc0f04
commit a328204d80
68 changed files with 10467 additions and 2274 deletions

View File

@@ -1,14 +1,15 @@
import { exec } from "child_process";
import { promisify } from "util";
import { field, logger, time, Time } from "@coder/logger";
import { escapePath } from "@coder/node-browser";
import { escapePath } from "@coder/server";
import { retry } from "./retry";
export interface IClientOptions {
mkDirs?: string[];
}
/**
* Client represents a general abstraction of an IDE client.
* A general abstraction of an IDE client.
*
* Everything the client provides is asynchronous so you can wait on what
* you need from it without blocking anything else.
@@ -36,6 +37,11 @@ export class Client {
await promisify(exec)(`mkdir -p ${options.mkDirs.map(escapePath).join(" ")}`);
}
});
// Prevent Firefox from trying to reconnect when the page unloads.
window.addEventListener("unload", () => {
retry.block();
});
}
/**