Merge pull request #6968 from yarax/master

New typings for fs-extra
This commit is contained in:
Masahiro Wakame
2015-12-01 23:14:00 +09:00
2 changed files with 29 additions and 1 deletions
+19 -1
View File
@@ -45,6 +45,7 @@ var openOpts: fs.OpenOptions;
var watcher: fs.FSWatcher;
var readStreeam: stream.Readable;
var writeStream: stream.Writable;
var outputStream: stream.Writable;
fs.copy(src, dest, errorCallback);
fs.copy(src, dest, (src: string) => {
@@ -150,7 +151,7 @@ strArr = fs.readdirSync(path);
fs.close(fd, errorCallback);
fs.closeSync(fd);
fs.open(path, flags, modeStr, (err: Error, fd: number) => {
});
num = fs.openSync(path, flags, modeStr);
fs.utimes(path, atime, mtime, errorCallback);
@@ -217,6 +218,17 @@ fs.exists(path, (exists: boolean) => {
});
bool = fs.existsSync(path);
fs.ensureDir(path, errorCallback);
fs.ensureDirSync(path);
fs.ensureFile(path, errorCallback);
fs.ensureFileSync(path);
fs.ensureLink(path, errorCallback);
fs.ensureLinkSync(path);
fs.ensureSymlink(path, errorCallback);
fs.ensureSymlinkSync(path);
fs.emptyDir(path, errorCallback);
fs.emptyDirSync(path);
readStreeam = fs.createReadStream(path);
readStreeam = fs.createReadStream(path, {
flags: str,
@@ -231,3 +243,9 @@ writeStream = fs.createWriteStream(path, {
encoding: str,
string: str
});
outputStream = fs.createOutputStream(path);
outputStream = fs.createOutputStream(path, {
flags: str,
encoding: str,
string: str
});
+10
View File
@@ -167,6 +167,15 @@ declare module "fs-extra" {
export function exists(path: string, callback?: (exists: boolean) => void ): void;
export function existsSync(path: string): boolean;
export function ensureDir(path: string, cb: (err: Error) => void): void;
export function ensureDirSync(path: string): void;
export function ensureFile(path: string, cb: (err: Error) => void): void;
export function ensureFileSync(path: string): void;
export function ensureLink(path: string, cb: (err: Error) => void): void;
export function ensureLinkSync(path: string): void;
export function ensureSymlink(path: string, cb: (err: Error) => void): void;
export function ensureSymlinkSync(path: string): void;
export function emptyDir(path: string, callback?: (err: Error) => void): void;
export function emptyDirSync(path: string): boolean;
export interface OpenOptions {
encoding?: string;
@@ -192,4 +201,5 @@ declare module "fs-extra" {
}
export function createReadStream(path: string, options?: ReadStreamOptions): ReadStream;
export function createWriteStream(path: string, options?: WriteStreamOptions): WriteStream;
export function createOutputStream(path: string, options?: WriteStreamOptions): WriteStream;
}