summaryrefslogtreecommitdiff
path: root/std/node/_fs
diff options
context:
space:
mode:
Diffstat (limited to 'std/node/_fs')
-rw-r--r--std/node/_fs/_fs_access.ts2
-rw-r--r--std/node/_fs/_fs_appendFile.ts6
-rw-r--r--std/node/_fs/_fs_appendFile_test.ts14
-rw-r--r--std/node/_fs/_fs_chmod.ts2
-rw-r--r--std/node/_fs/_fs_chown.ts2
-rw-r--r--std/node/_fs/_fs_common.ts9
-rw-r--r--std/node/_fs/_fs_copy.ts2
-rw-r--r--std/node/_fs/_fs_dir_test.ts7
-rw-r--r--std/node/_fs/_fs_dirent.ts4
-rw-r--r--std/node/_fs/_fs_dirent_test.ts4
-rw-r--r--std/node/_fs/_fs_link.ts14
-rw-r--r--std/node/_fs/_fs_mkdir.ts6
-rw-r--r--std/node/_fs/_fs_readFile.ts18
-rw-r--r--std/node/_fs/_fs_readFile_test.ts2
-rw-r--r--std/node/_fs/_fs_readlink.ts12
-rw-r--r--std/node/_fs/_fs_writeFile.ts4
-rw-r--r--std/node/_fs/_fs_writeFile_test.ts42
-rw-r--r--std/node/_fs/promises/_fs_readFile.ts6
-rw-r--r--std/node/_fs/promises/_fs_readFile_test.ts2
-rw-r--r--std/node/_fs/promises/_fs_writeFile.ts2
-rw-r--r--std/node/_fs/promises/_fs_writeFile_test.ts18
21 files changed, 91 insertions, 87 deletions
diff --git a/std/node/_fs/_fs_access.ts b/std/node/_fs/_fs_access.ts
index 79e4ca96d..df84eac9c 100644
--- a/std/node/_fs/_fs_access.ts
+++ b/std/node/_fs/_fs_access.ts
@@ -10,7 +10,7 @@ import { notImplemented } from "../_utils.ts";
export function access(
path: string | URL, // eslint-disable-line @typescript-eslint/no-unused-vars
modeOrCallback: number | Function, // eslint-disable-line @typescript-eslint/no-unused-vars
- callback?: CallbackWithError // eslint-disable-line @typescript-eslint/no-unused-vars
+ callback?: CallbackWithError, // eslint-disable-line @typescript-eslint/no-unused-vars
): void {
notImplemented("Not yet available");
}
diff --git a/std/node/_fs/_fs_appendFile.ts b/std/node/_fs/_fs_appendFile.ts
index c057c1f65..bc30de609 100644
--- a/std/node/_fs/_fs_appendFile.ts
+++ b/std/node/_fs/_fs_appendFile.ts
@@ -17,7 +17,7 @@ export function appendFile(
pathOrRid: string | number | URL,
data: string,
optionsOrCallback: Encodings | WriteFileOptions | CallbackWithError,
- callback?: CallbackWithError
+ callback?: CallbackWithError,
): void {
pathOrRid = pathOrRid instanceof URL ? fromFileUrl(pathOrRid) : pathOrRid;
const callbackFn: CallbackWithError | undefined =
@@ -80,7 +80,7 @@ function closeRidIfNecessary(isPathString: boolean, rid: number): void {
export function appendFileSync(
pathOrRid: string | number | URL,
data: string,
- options?: Encodings | WriteFileOptions
+ options?: Encodings | WriteFileOptions,
): void {
let rid = -1;
@@ -116,7 +116,7 @@ export function appendFileSync(
}
function validateEncoding(
- encodingOption: Encodings | WriteFileOptions | undefined
+ encodingOption: Encodings | WriteFileOptions | undefined,
): void {
if (!encodingOption) return;
diff --git a/std/node/_fs/_fs_appendFile_test.ts b/std/node/_fs/_fs_appendFile_test.ts
index 9c0ccb666..d41065205 100644
--- a/std/node/_fs/_fs_appendFile_test.ts
+++ b/std/node/_fs/_fs_appendFile_test.ts
@@ -13,7 +13,7 @@ Deno.test({
appendFile("some/path", "some data", "utf8");
},
Error,
- "No callback function supplied"
+ "No callback function supplied",
);
},
});
@@ -27,7 +27,7 @@ Deno.test({
appendFile("some/path", "some data", "made-up-encoding", () => {});
},
Error,
- "Only 'utf8' encoding is currently supported"
+ "Only 'utf8' encoding is currently supported",
);
assertThrows(
() => {
@@ -36,17 +36,17 @@ Deno.test({
"some data",
// @ts-expect-error Type '"made-up-encoding"' is not assignable to type
{ encoding: "made-up-encoding" },
- () => {}
+ () => {},
);
},
Error,
- "Only 'utf8' encoding is currently supported"
+ "Only 'utf8' encoding is currently supported",
);
assertThrows(
// @ts-expect-error Type '"made-up-encoding"' is not assignable to type
() => appendFileSync("some/path", "some data", "made-up-encoding"),
Error,
- "Only 'utf8' encoding is currently supported"
+ "Only 'utf8' encoding is currently supported",
);
assertThrows(
() =>
@@ -55,7 +55,7 @@ Deno.test({
encoding: "made-up-encoding",
}),
Error,
- "Only 'utf8' encoding is currently supported"
+ "Only 'utf8' encoding is currently supported",
);
},
});
@@ -200,7 +200,7 @@ Deno.test({
assertThrows(
() => appendFileSync(tempFile, "hello world", { flag: "ax" }),
Deno.errors.AlreadyExists,
- ""
+ "",
);
assertEquals(Deno.resources(), openResourcesBeforeAppend);
Deno.removeSync(tempFile);
diff --git a/std/node/_fs/_fs_chmod.ts b/std/node/_fs/_fs_chmod.ts
index 844afd21d..9a8277b45 100644
--- a/std/node/_fs/_fs_chmod.ts
+++ b/std/node/_fs/_fs_chmod.ts
@@ -12,7 +12,7 @@ const allowedModes = /^[0-7]{3}/;
export function chmod(
path: string | URL,
mode: string | number,
- callback: CallbackWithError
+ callback: CallbackWithError,
): void {
path = path instanceof URL ? fromFileUrl(path) : path;
diff --git a/std/node/_fs/_fs_chown.ts b/std/node/_fs/_fs_chown.ts
index 56068ef73..ae3af0121 100644
--- a/std/node/_fs/_fs_chown.ts
+++ b/std/node/_fs/_fs_chown.ts
@@ -11,7 +11,7 @@ export function chown(
path: string | URL,
uid: number,
gid: number,
- callback: CallbackWithError
+ callback: CallbackWithError,
): void {
path = path instanceof URL ? fromFileUrl(path) : path;
diff --git a/std/node/_fs/_fs_common.ts b/std/node/_fs/_fs_common.ts
index 3c20ca73e..165b9aeca 100644
--- a/std/node/_fs/_fs_common.ts
+++ b/std/node/_fs/_fs_common.ts
@@ -35,7 +35,7 @@ export interface WriteFileOptions extends FileOptions {
}
export function isFileOptions(
- fileOptions: string | WriteFileOptions | undefined
+ fileOptions: string | WriteFileOptions | undefined,
): fileOptions is FileOptions {
if (!fileOptions) return false;
@@ -47,14 +47,15 @@ export function isFileOptions(
}
export function getEncoding(
- optOrCallback?: FileOptions | WriteFileOptions | Function | Encodings | null
+ optOrCallback?: FileOptions | WriteFileOptions | Function | Encodings | null,
): Encodings | null {
if (!optOrCallback || typeof optOrCallback === "function") {
return null;
}
- const encoding =
- typeof optOrCallback === "string" ? optOrCallback : optOrCallback.encoding;
+ const encoding = typeof optOrCallback === "string"
+ ? optOrCallback
+ : optOrCallback.encoding;
if (!encoding) return null;
return encoding;
}
diff --git a/std/node/_fs/_fs_copy.ts b/std/node/_fs/_fs_copy.ts
index 72f43d18f..ba530a85c 100644
--- a/std/node/_fs/_fs_copy.ts
+++ b/std/node/_fs/_fs_copy.ts
@@ -6,7 +6,7 @@ import { fromFileUrl } from "../path.ts";
export function copyFile(
source: string | URL,
destination: string,
- callback: CallbackWithError
+ callback: CallbackWithError,
): void {
source = source instanceof URL ? fromFileUrl(source) : source;
diff --git a/std/node/_fs/_fs_dir_test.ts b/std/node/_fs/_fs_dir_test.ts
index 2d2d5f585..4c2806389 100644
--- a/std/node/_fs/_fs_dir_test.ts
+++ b/std/node/_fs/_fs_dir_test.ts
@@ -49,7 +49,7 @@ Deno.test({
let calledBack = false;
const fileFromCallback: Dirent | null = await new Dir(
- testDir
+ testDir,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
).read((err: any, res: Dirent) => {
assert(res === null);
@@ -83,10 +83,11 @@ Deno.test({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(err: any, secondResult: Dirent) => {
assert(
- secondResult.name === "bar.txt" || secondResult.name === "foo.txt"
+ secondResult.name === "bar.txt" ||
+ secondResult.name === "foo.txt",
);
secondCallback = true;
- }
+ },
);
const thirdRead: Dirent | null = await dir.read();
const fourthRead: Dirent | null = await dir.read();
diff --git a/std/node/_fs/_fs_dirent.ts b/std/node/_fs/_fs_dirent.ts
index 3ea1def42..24e43145c 100644
--- a/std/node/_fs/_fs_dirent.ts
+++ b/std/node/_fs/_fs_dirent.ts
@@ -10,7 +10,7 @@ export default class Dirent {
isCharacterDevice(): boolean {
notImplemented(
- "Deno does not yet support identification of character devices"
+ "Deno does not yet support identification of character devices",
);
return false;
}
@@ -21,7 +21,7 @@ export default class Dirent {
isFIFO(): boolean {
notImplemented(
- "Deno does not yet support identification of FIFO named pipes"
+ "Deno does not yet support identification of FIFO named pipes",
);
return false;
}
diff --git a/std/node/_fs/_fs_dirent_test.ts b/std/node/_fs/_fs_dirent_test.ts
index 8c4b98214..aeb20f1d5 100644
--- a/std/node/_fs/_fs_dirent_test.ts
+++ b/std/node/_fs/_fs_dirent_test.ts
@@ -65,14 +65,14 @@ Deno.test({
new Dirent(entry).isFIFO();
},
Error,
- "does not yet support"
+ "does not yet support",
);
assertThrows(
() => {
new Dirent(entry).isSocket();
},
Error,
- "does not yet support"
+ "does not yet support",
);
},
});
diff --git a/std/node/_fs/_fs_link.ts b/std/node/_fs/_fs_link.ts
index df08e13b1..42ca3de89 100644
--- a/std/node/_fs/_fs_link.ts
+++ b/std/node/_fs/_fs_link.ts
@@ -10,10 +10,11 @@ import { fromFileUrl } from "../path.ts";
export function link(
existingPath: string | URL,
newPath: string | URL,
- callback: CallbackWithError
+ callback: CallbackWithError,
): void {
- existingPath =
- existingPath instanceof URL ? fromFileUrl(existingPath) : existingPath;
+ existingPath = existingPath instanceof URL
+ ? fromFileUrl(existingPath)
+ : existingPath;
newPath = newPath instanceof URL ? fromFileUrl(newPath) : newPath;
Deno.link(existingPath, newPath)
@@ -27,10 +28,11 @@ export function link(
*/
export function linkSync(
existingPath: string | URL,
- newPath: string | URL
+ newPath: string | URL,
): void {
- existingPath =
- existingPath instanceof URL ? fromFileUrl(existingPath) : existingPath;
+ existingPath = existingPath instanceof URL
+ ? fromFileUrl(existingPath)
+ : existingPath;
newPath = newPath instanceof URL ? fromFileUrl(newPath) : newPath;
Deno.linkSync(existingPath, newPath);
diff --git a/std/node/_fs/_fs_mkdir.ts b/std/node/_fs/_fs_mkdir.ts
index 8578f4653..63aabd010 100644
--- a/std/node/_fs/_fs_mkdir.ts
+++ b/std/node/_fs/_fs_mkdir.ts
@@ -14,7 +14,7 @@ type MkdirOptions =
export function mkdir(
path: string | URL,
options?: MkdirOptions | CallbackWithError,
- callback?: CallbackWithError
+ callback?: CallbackWithError,
): void {
path = path instanceof URL ? fromFileUrl(path) : path;
@@ -33,7 +33,7 @@ export function mkdir(
}
if (typeof recursive !== "boolean") {
throw new Deno.errors.InvalidData(
- "invalid recursive option , must be a boolean"
+ "invalid recursive option , must be a boolean",
);
}
Deno.mkdir(path, { recursive, mode })
@@ -64,7 +64,7 @@ export function mkdirSync(path: string | URL, options?: MkdirOptions): void {
}
if (typeof recursive !== "boolean") {
throw new Deno.errors.InvalidData(
- "invalid recursive option , must be a boolean"
+ "invalid recursive option , must be a boolean",
);
}
diff --git a/std/node/_fs/_fs_readFile.ts b/std/node/_fs/_fs_readFile.ts
index 39c3d8393..2aef28290 100644
--- a/std/node/_fs/_fs_readFile.ts
+++ b/std/node/_fs/_fs_readFile.ts
@@ -14,11 +14,11 @@ import { fromFileUrl } from "../path.ts";
function maybeDecode(data: Uint8Array, encoding: TextEncodings): string;
function maybeDecode(
data: Uint8Array,
- encoding: BinaryEncodings | null
+ encoding: BinaryEncodings | null,
): Buffer;
function maybeDecode(
data: Uint8Array,
- encoding: Encodings | null
+ encoding: Encodings | null,
): string | Buffer {
const buffer = new Buffer(data.buffer, data.byteOffset, data.byteLength);
if (encoding && encoding !== "binary") return buffer.toString(encoding);
@@ -33,23 +33,23 @@ type Callback = TextCallback | BinaryCallback | GenericCallback;
export function readFile(
path: string | URL,
options: TextOptionsArgument,
- callback: TextCallback
+ callback: TextCallback,
): void;
export function readFile(
path: string | URL,
options: BinaryOptionsArgument,
- callback: BinaryCallback
+ callback: BinaryCallback,
): void;
export function readFile(
path: string | URL,
options: null | undefined | FileOptionsArgument,
- callback: BinaryCallback
+ callback: BinaryCallback,
): void;
export function readFile(path: string | URL, callback: BinaryCallback): void;
export function readFile(
path: string | URL,
optOrCallback?: FileOptionsArgument | Callback | null | undefined,
- callback?: Callback
+ callback?: Callback,
): void {
path = path instanceof URL ? fromFileUrl(path) : path;
let cb: Callback | undefined;
@@ -77,15 +77,15 @@ export function readFile(
export function readFileSync(
path: string | URL,
- opt: TextOptionsArgument
+ opt: TextOptionsArgument,
): string;
export function readFileSync(
path: string | URL,
- opt?: BinaryOptionsArgument
+ opt?: BinaryOptionsArgument,
): Buffer;
export function readFileSync(
path: string | URL,
- opt?: FileOptionsArgument
+ opt?: FileOptionsArgument,
): string | Buffer {
path = path instanceof URL ? fromFileUrl(path) : path;
const data = Deno.readFileSync(path);
diff --git a/std/node/_fs/_fs_readFile_test.ts b/std/node/_fs/_fs_readFile_test.ts
index 076c4b276..ff449dbb2 100644
--- a/std/node/_fs/_fs_readFile_test.ts
+++ b/std/node/_fs/_fs_readFile_test.ts
@@ -3,7 +3,7 @@ import * as path from "../../path/mod.ts";
import { assertEquals, assert } from "../../testing/asserts.ts";
const testData = path.resolve(
- path.join("node", "_fs", "testdata", "hello.txt")
+ path.join("node", "_fs", "testdata", "hello.txt"),
);
Deno.test("readFileSuccess", async function () {
diff --git a/std/node/_fs/_fs_readlink.ts b/std/node/_fs/_fs_readlink.ts
index 11ce43f55..866ea187b 100644
--- a/std/node/_fs/_fs_readlink.ts
+++ b/std/node/_fs/_fs_readlink.ts
@@ -8,7 +8,7 @@ import { fromFileUrl } from "../path.ts";
type ReadlinkCallback = (
err: MaybeEmpty<Error>,
- linkString: MaybeEmpty<string | Uint8Array>
+ linkString: MaybeEmpty<string | Uint8Array>,
) => void;
interface ReadlinkOptions {
@@ -17,7 +17,7 @@ interface ReadlinkOptions {
function maybeEncode(
data: string,
- encoding: string | null
+ encoding: string | null,
): string | Uint8Array {
if (encoding === "buffer") {
return new TextEncoder().encode(data);
@@ -26,7 +26,7 @@ function maybeEncode(
}
function getEncoding(
- optOrCallback?: ReadlinkOptions | ReadlinkCallback
+ optOrCallback?: ReadlinkOptions | ReadlinkCallback,
): string | null {
if (!optOrCallback || typeof optOrCallback === "function") {
return null;
@@ -50,7 +50,7 @@ function getEncoding(
export function readlink(
path: string | URL,
optOrCallback: ReadlinkCallback | ReadlinkOptions,
- callback?: ReadlinkCallback
+ callback?: ReadlinkCallback,
): void {
path = path instanceof URL ? fromFileUrl(path) : path;
@@ -67,13 +67,13 @@ export function readlink(
Deno.readLink,
(data: string): string | Uint8Array => maybeEncode(data, encoding),
cb,
- path
+ path,
);
}
export function readlinkSync(
path: string | URL,
- opt?: ReadlinkOptions
+ opt?: ReadlinkOptions,
): string | Uint8Array {
path = path instanceof URL ? fromFileUrl(path) : path;
diff --git a/std/node/_fs/_fs_writeFile.ts b/std/node/_fs/_fs_writeFile.ts
index 8a66f3f3d..a8ae1f586 100644
--- a/std/node/_fs/_fs_writeFile.ts
+++ b/std/node/_fs/_fs_writeFile.ts
@@ -17,7 +17,7 @@ export function writeFile(
pathOrRid: string | number | URL,
data: string | Uint8Array,
optOrCallback: Encodings | CallbackWithError | WriteFileOptions | undefined,
- callback?: CallbackWithError
+ callback?: CallbackWithError,
): void {
const callbackFn: CallbackWithError | undefined =
optOrCallback instanceof Function ? optOrCallback : callback;
@@ -72,7 +72,7 @@ export function writeFile(
export function writeFileSync(
pathOrRid: string | number | URL,
data: string | Uint8Array,
- options?: Encodings | WriteFileOptions
+ options?: Encodings | WriteFileOptions,
): void {
pathOrRid = pathOrRid instanceof URL ? fromFileUrl(pathOrRid) : pathOrRid;
diff --git a/std/node/_fs/_fs_writeFile_test.ts b/std/node/_fs/_fs_writeFile_test.ts
index 015ed6553..a11e0fb67 100644
--- a/std/node/_fs/_fs_writeFile_test.ts
+++ b/std/node/_fs/_fs_writeFile_test.ts
@@ -18,7 +18,7 @@ Deno.test("Callback must be a function error", function fn() {
writeFile("some/path", "some data", "utf8");
},
TypeError,
- "Callback must be a function."
+ "Callback must be a function.",
);
});
@@ -29,7 +29,7 @@ Deno.test("Invalid encoding results in error()", function testEncodingErrors() {
writeFile("some/path", "some data", "made-up-encoding", () => {});
},
Error,
- `The value "made-up-encoding" is invalid for option "encoding"`
+ `The value "made-up-encoding" is invalid for option "encoding"`,
);
assertThrows(
@@ -38,7 +38,7 @@ Deno.test("Invalid encoding results in error()", function testEncodingErrors() {
writeFileSync("some/path", "some data", "made-up-encoding");
},
Error,
- `The value "made-up-encoding" is invalid for option "encoding"`
+ `The value "made-up-encoding" is invalid for option "encoding"`,
);
assertThrows(
@@ -50,11 +50,11 @@ Deno.test("Invalid encoding results in error()", function testEncodingErrors() {
// @ts-expect-error Type '"made-up-encoding"' is not assignable to type
encoding: "made-up-encoding",
},
- () => {}
+ () => {},
);
},
Error,
- `The value "made-up-encoding" is invalid for option "encoding"`
+ `The value "made-up-encoding" is invalid for option "encoding"`,
);
assertThrows(
@@ -65,7 +65,7 @@ Deno.test("Invalid encoding results in error()", function testEncodingErrors() {
});
},
Error,
- `The value "made-up-encoding" is invalid for option "encoding"`
+ `The value "made-up-encoding" is invalid for option "encoding"`,
);
});
@@ -77,7 +77,7 @@ Deno.test(
writeFile("some/path", "some data", "utf16le", () => {});
},
Error,
- `Not implemented: "utf16le" encoding`
+ `Not implemented: "utf16le" encoding`,
);
assertThrows(
@@ -85,9 +85,9 @@ Deno.test(
writeFileSync("some/path", "some data", "utf16le");
},
Error,
- `Not implemented: "utf16le" encoding`
+ `Not implemented: "utf16le" encoding`,
);
- }
+ },
);
Deno.test(
@@ -111,7 +111,7 @@ Deno.test(
const data = await Deno.readFile(tempFile);
await Deno.remove(tempFile);
assertEquals(decoder.decode(data), "hello world");
- }
+ },
);
Deno.test(
@@ -125,7 +125,7 @@ Deno.test(
await Deno.remove("_fs_writeFile_test_file.txt");
assertEquals(res, null);
assertEquals(decoder.decode(data), "hello world");
- }
+ },
);
Deno.test(
@@ -146,7 +146,7 @@ Deno.test(
"_fs_writeFile_test_file.txt",
value,
encoding as TextEncodings,
- resolve
+ resolve,
);
});
@@ -155,7 +155,7 @@ Deno.test(
assertEquals(res, null);
assertEquals(decoder.decode(data), "hello world");
}
- }
+ },
);
Deno.test("Path can be an URL", async function testCorrectWriteUsingURL() {
@@ -165,7 +165,7 @@ Deno.test("Path can be an URL", async function testCorrectWriteUsingURL() {
path
.join(testDataDir, "_fs_writeFile_test_file_url.txt")
.replace(/\\/g, "/")
- : "file://" + path.join(testDataDir, "_fs_writeFile_test_file_url.txt")
+ : "file://" + path.join(testDataDir, "_fs_writeFile_test_file_url.txt"),
);
const filePath = path.fromFileUrl(url);
const res = await new Promise((resolve) => {
@@ -218,7 +218,7 @@ Deno.test(
await Deno.remove(filename);
assert(fileInfo.mode);
assertNotEquals(fileInfo.mode & 0o777, 0o777);
- }
+ },
);
Deno.test(
@@ -237,7 +237,7 @@ Deno.test(
const data = Deno.readFileSync(tempFile);
Deno.removeSync(tempFile);
assertEquals(decoder.decode(data), "hello world");
- }
+ },
);
Deno.test(
@@ -260,7 +260,7 @@ Deno.test(
Deno.removeSync(file);
assertEquals(decoder.decode(data), "hello world");
}
- }
+ },
);
Deno.test(
@@ -273,18 +273,18 @@ Deno.test(
const data = Deno.readFileSync(file);
Deno.removeSync(file);
assertEquals(decoder.decode(data), "hello world");
- }
+ },
);
Deno.test("sync: Path can be an URL", function testCorrectWriteSyncUsingURL() {
const filePath = path.join(
testDataDir,
- "_fs_writeFileSync_test_file_url.txt"
+ "_fs_writeFileSync_test_file_url.txt",
);
const url = new URL(
Deno.build.os === "windows"
? "file:///" + filePath.replace(/\\/g, "/")
- : "file://" + filePath
+ : "file://" + filePath,
);
writeFileSync(url, "hello world");
@@ -305,5 +305,5 @@ Deno.test(
Deno.removeSync(filename);
assert(fileInfo && fileInfo.mode);
assertEquals(fileInfo.mode & 0o777, 0o777);
- }
+ },
);
diff --git a/std/node/_fs/promises/_fs_readFile.ts b/std/node/_fs/promises/_fs_readFile.ts
index 8677e05cd..446c48625 100644
--- a/std/node/_fs/promises/_fs_readFile.ts
+++ b/std/node/_fs/promises/_fs_readFile.ts
@@ -8,15 +8,15 @@ import { readFile as readFileCallback } from "../_fs_readFile.ts";
export function readFile(
path: string | URL,
- options: TextOptionsArgument
+ options: TextOptionsArgument,
): Promise<string>;
export function readFile(
path: string | URL,
- options?: BinaryOptionsArgument
+ options?: BinaryOptionsArgument,
): Promise<Uint8Array>;
export function readFile(
path: string | URL,
- options?: FileOptionsArgument
+ options?: FileOptionsArgument,
): Promise<string | Uint8Array> {
return new Promise((resolve, reject) => {
readFileCallback(path, options, (err, data): void => {
diff --git a/std/node/_fs/promises/_fs_readFile_test.ts b/std/node/_fs/promises/_fs_readFile_test.ts
index 1d2097881..a5f5a1327 100644
--- a/std/node/_fs/promises/_fs_readFile_test.ts
+++ b/std/node/_fs/promises/_fs_readFile_test.ts
@@ -3,7 +3,7 @@ import * as path from "../../../path/mod.ts";
import { assertEquals, assert } from "../../../testing/asserts.ts";
const testData = path.resolve(
- path.join("node", "_fs", "testdata", "hello.txt")
+ path.join("node", "_fs", "testdata", "hello.txt"),
);
Deno.test("readFileSuccess", async function () {
diff --git a/std/node/_fs/promises/_fs_writeFile.ts b/std/node/_fs/promises/_fs_writeFile.ts
index 48b9bf0ea..1c9ea5032 100644
--- a/std/node/_fs/promises/_fs_writeFile.ts
+++ b/std/node/_fs/promises/_fs_writeFile.ts
@@ -6,7 +6,7 @@ import { writeFile as writeFileCallback } from "../_fs_writeFile.ts";
export function writeFile(
pathOrRid: string | number | URL,
data: string | Uint8Array,
- options?: Encodings | WriteFileOptions
+ options?: Encodings | WriteFileOptions,
): Promise<void> {
return new Promise((resolve, reject) => {
writeFileCallback(pathOrRid, data, options, (err?: Error | null) => {
diff --git a/std/node/_fs/promises/_fs_writeFile_test.ts b/std/node/_fs/promises/_fs_writeFile_test.ts
index 6901fff22..698284057 100644
--- a/std/node/_fs/promises/_fs_writeFile_test.ts
+++ b/std/node/_fs/promises/_fs_writeFile_test.ts
@@ -17,7 +17,7 @@ Deno.test("Invalid encoding results in error()", function testEncodingErrors() {
await writeFile("some/path", "some data", "made-up-encoding");
},
Error,
- `The value "made-up-encoding" is invalid for option "encoding"`
+ `The value "made-up-encoding" is invalid for option "encoding"`,
);
assertThrowsAsync(
async () => {
@@ -27,7 +27,7 @@ Deno.test("Invalid encoding results in error()", function testEncodingErrors() {
});
},
Error,
- `The value "made-up-encoding" is invalid for option "encoding"`
+ `The value "made-up-encoding" is invalid for option "encoding"`,
);
});
@@ -39,9 +39,9 @@ Deno.test(
await writeFile("some/path", "some data", "utf16le");
},
Error,
- `Not implemented: "utf16le" encoding`
+ `Not implemented: "utf16le" encoding`,
);
- }
+ },
);
Deno.test(
@@ -60,7 +60,7 @@ Deno.test(
const data = await Deno.readFile(tempFile);
await Deno.remove(tempFile);
assertEquals(decoder.decode(data), "hello world");
- }
+ },
);
Deno.test(
@@ -74,7 +74,7 @@ Deno.test(
const data = await Deno.readFile("_fs_writeFile_test_file.txt");
await Deno.remove("_fs_writeFile_test_file.txt");
assertEquals(decoder.decode(data), "hello world");
- }
+ },
);
Deno.test(
@@ -93,14 +93,14 @@ Deno.test(
await writeFile(
"_fs_writeFile_test_file.txt",
value,
- encoding as TextEncodings
+ encoding as TextEncodings,
);
const data = await Deno.readFile("_fs_writeFile_test_file.txt");
await Deno.remove("_fs_writeFile_test_file.txt");
assertEquals(decoder.decode(data), "hello world");
}
- }
+ },
);
Deno.test("Mode is correctly set", async function testCorrectFileMode() {
@@ -133,5 +133,5 @@ Deno.test(
await Deno.remove(filename);
assert(fileInfo.mode);
assertNotEquals(fileInfo.mode & 0o777, 0o777);
- }
+ },
);