mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Add fs.writeFileSync overloads and tests
This commit is contained in:
Vendored
+1
@@ -2835,6 +2835,7 @@ declare module "fs" {
|
||||
export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFileSync(filename: string, data: any, encoding: string): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
||||
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
|
||||
@@ -169,6 +169,9 @@ namespace fs_tests {
|
||||
encoding: "ascii"
|
||||
},
|
||||
assert.ifError);
|
||||
|
||||
fs.writeFileSync("testfile", "content", "utf8");
|
||||
fs.writeFileSync("testfile", "content", { encoding: "utf8" });
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -47,6 +47,8 @@ fs.writeFile("Harry Potter",
|
||||
},
|
||||
assert.ifError);
|
||||
|
||||
fs.writeFileSync("testfile", "content", { encoding: "utf8" });
|
||||
|
||||
var content: string,
|
||||
buffer: Buffer;
|
||||
|
||||
|
||||
Vendored
+1
@@ -1775,6 +1775,7 @@ declare module "fs" {
|
||||
export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFileSync(filename: string, data: any, encoding: string): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
||||
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
|
||||
@@ -151,6 +151,9 @@ namespace fs_tests {
|
||||
encoding: "ascii"
|
||||
},
|
||||
assert.ifError);
|
||||
|
||||
fs.writeFileSync("testfile", "content", "utf8");
|
||||
fs.writeFileSync("testfile", "content", { encoding: "utf8" });
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Vendored
+1
@@ -2564,6 +2564,7 @@ declare module "fs" {
|
||||
export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFileSync(filename: string, data: any, encoding: string): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
||||
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
|
||||
@@ -168,6 +168,9 @@ namespace fs_tests {
|
||||
encoding: "ascii"
|
||||
},
|
||||
assert.ifError);
|
||||
|
||||
fs.writeFileSync("testfile", "content", "utf8");
|
||||
fs.writeFileSync("testfile", "content", { encoding: "utf8" });
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Vendored
+1
@@ -2693,6 +2693,7 @@ declare module "fs" {
|
||||
export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFileSync(filename: string, data: any, encoding: string): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
||||
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
|
||||
@@ -169,6 +169,9 @@ namespace fs_tests {
|
||||
encoding: "ascii"
|
||||
},
|
||||
assert.ifError);
|
||||
|
||||
fs.writeFileSync("testfile", "content", "utf8");
|
||||
fs.writeFileSync("testfile", "content", { encoding: "utf8" });
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user