| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -254,7 +254,7 @@ function exists(path, callback) { | |||
| 254 | 254 | validateFunction(callback, 'cb'); | |
| 255 | 255 | ||
| 256 | 256 | function suppressedCallback(err) { | |
| 257 | - callback(err ? false : true); | ||
| 257 | + callback(!err); | ||
| 258 | 258 | } | |
| 259 | 259 | ||
| 260 | 260 | try { | |
@@ -759,8 +759,8 @@ function readSync(fd, buffer, offsetOrOptions, length, position) { | |||
| 759 | 759 | * @param {( | |
| 760 | 760 | * err?: Error, | |
| 761 | 761 | * bytesRead?: number, | |
| 762 | - * buffers?: ArrayBufferView[]; | ||
| 763 | - * ) => any} callback | ||
| 762 | + * buffers?: ArrayBufferView[] | ||
| 763 | + * ) => any} callback | ||
| 764 | 764 | * @returns {void} | |
| 765 | 765 | */ | |
| 766 | 766 | function readv(fd, buffers, position, callback) { | |
@@ -813,9 +813,9 @@ function readvSync(fd, buffers, position) { | |||
| 813 | 813 | * @param {number | null} [position] | |
| 814 | 814 | * @param {( | |
| 815 | 815 | * err?: Error, | |
| 816 | - * bytesWritten?: number; | ||
| 816 | + * bytesWritten?: number, | ||
| 817 | 817 | * buffer?: Buffer | TypedArray | DataView | |
| 818 | - * ) => any} callback | ||
| 818 | + * ) => any} callback | ||
| 819 | 819 | * @returns {void} | |
| 820 | 820 | */ | |
| 821 | 821 | function write(fd, buffer, offsetOrOptions, length, position, callback) { | |
@@ -891,6 +891,8 @@ ObjectDefineProperty(write, kCustomPromisifyArgsSymbol, | |||
| 891 | 891 | * length?: number; | |
| 892 | 892 | * position?: number | null; | |
| 893 | 893 | * }} [offsetOrOptions] | |
| 894 | + * @param {number} [length] | ||
| 895 | + * @param {number} [position] | ||
| 894 | 896 | * @returns {number} | |
| 895 | 897 | */ | |
| 896 | 898 | function writeSync(fd, buffer, offsetOrOptions, length, position) { | |
@@ -1084,14 +1086,11 @@ function truncateSync(path, len) { | |||
| 1084 | 1086 | } | |
| 1085 | 1087 | // Allow error to be thrown, but still close fd. | |
| 1086 | 1088 | const fd = fs.openSync(path, 'r+'); | |
| 1087 | - let ret; | ||
| 1088 | - | ||
| 1089 | 1089 | try { | |
| 1090 | - ret = fs.ftruncateSync(fd, len); | ||
| 1090 | + fs.ftruncateSync(fd, len); | ||
| 1091 | 1091 | } finally { | |
| 1092 | 1092 | fs.closeSync(fd); | |
| 1093 | 1093 | } | |
| 1094 | - return ret; | ||
| 1095 | 1094 | } | |
| 1096 | 1095 | ||
| 1097 | 1096 | /** | |
@@ -1450,8 +1449,8 @@ function readdirSyncRecursive(basePath, options) { | |||
| 1450 | 1449 | * }} [options] | |
| 1451 | 1450 | * @param {( | |
| 1452 | 1451 | * err?: Error, | |
| 1453 | - * files?: string[] | Buffer[] | Dirent[]; | ||
| 1454 | - * ) => any} callback | ||
| 1452 | + * files?: string[] | Buffer[] | Dirent[] | ||
| 1453 | + * ) => any} callback | ||
| 1455 | 1454 | * @returns {void} | |
| 1456 | 1455 | */ | |
| 1457 | 1456 | function readdir(path, options, callback) { | |
@@ -1957,13 +1956,11 @@ function lchmodSync(path, mode) { | |||
| 1957 | 1956 | ||
| 1958 | 1957 | // Prefer to return the chmod error, if one occurs, | |
| 1959 | 1958 | // but still try to close, and report closing errors if they occur. | |
| 1960 | - let ret; | ||
| 1961 | 1959 | try { | |
| 1962 | - ret = fs.fchmodSync(fd, mode); | ||
| 1960 | + fs.fchmodSync(fd, mode); | ||
| 1963 | 1961 | } finally { | |
| 1964 | 1962 | fs.closeSync(fd); | |
| 1965 | 1963 | } | |
| 1966 | - return ret; | ||
| 1967 | 1964 | } | |
| 1968 | 1965 | ||
| 1969 | 1966 | /** | |
@@ -2838,7 +2835,7 @@ function realpath(p, options, callback) { | |||
| 2838 | 2835 | ||
| 2839 | 2836 | // On windows, check that the root exists. On unix there is no need. | |
| 2840 | 2837 | if (isWindows && !knownHard.has(base)) { | |
| 2841 | - fs.lstat(base, (err, stats) => { | ||
| 2838 | + fs.lstat(base, (err) => { | ||
| 2842 | 2839 | if (err) return callback(err); | |
| 2843 | 2840 | knownHard.add(base); | |
| 2844 | 2841 | LOOP(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,7 +57,7 @@ declare namespace InternalFSBinding { | |||
| 57 | 57 | } | |
| 58 | 58 | ||
| 59 | 59 | function access(path: StringOrBuffer, mode: number, req: FSReqCallback): void; | |
| 60 | - function access(path: StringOrBuffer, mode: number, req: undefined, ctx: FSSyncContext): void; | ||
| 60 | + function access(path: StringOrBuffer, mode: number): void; | ||
| 61 | 61 | function access(path: StringOrBuffer, mode: number, usePromises: typeof kUsePromises): Promise<void>; | |
| 62 | 62 | ||
| 63 | 63 | function chmod(path: string, mode: number, req: FSReqCallback): void; | |
@@ -70,7 +70,7 @@ declare namespace InternalFSBinding { | |||
| 70 | 70 | function chown(path: string, uid: number, gid: number): void; | |
| 71 | 71 | ||
| 72 | 72 | function close(fd: number, req: FSReqCallback): void; | |
| 73 | - function close(fd: number, req: undefined, ctx: FSSyncContext): void; | ||
| 73 | + function close(fd: number): void; | ||
| 74 | 74 | ||
| 75 | 75 | function copyFile(src: StringOrBuffer, dest: StringOrBuffer, mode: number, req: FSReqCallback): void; | |
| 76 | 76 | function copyFile(src: StringOrBuffer, dest: StringOrBuffer, mode: number, req: undefined, ctx: FSSyncContext): void; | |
@@ -154,7 +154,7 @@ declare namespace InternalFSBinding { | |||
| 154 | 154 | function mkdir(path: string, mode: number, recursive: false, usePromises: typeof kUsePromises): Promise<void>; | |
| 155 | 155 | ||
| 156 | 156 | function open(path: StringOrBuffer, flags: number, mode: number, req: FSReqCallback<number>): void; | |
| 157 | - function open(path: StringOrBuffer, flags: number, mode: number, req: undefined, ctx: FSSyncContext): number; | ||
| 157 | + function open(path: StringOrBuffer, flags: number, mode: number): number; | ||
| 158 | 158 | ||
| 159 | 159 | function openFileHandle(path: StringOrBuffer, flags: number, mode: number, usePromises: typeof kUsePromises): Promise<FileHandle>; | |
| 160 | 160 | ||
@@ -176,6 +176,8 @@ declare namespace InternalFSBinding { | |||
| 176 | 176 | function readdir(path: StringOrBuffer, encoding: unknown, withFileTypes: true, usePromises: typeof kUsePromises): Promise<[string[], number[]]>; | |
| 177 | 177 | function readdir(path: StringOrBuffer, encoding: unknown, withFileTypes: false, usePromises: typeof kUsePromises): Promise<string[]>; | |
| 178 | 178 | ||
| 179 | + function readFileUtf8(path: StringOrBuffer, flags: number): string; | ||
| 180 | + | ||
| 179 | 181 | function readlink(path: StringOrBuffer, encoding: unknown, req: FSReqCallback<string | Buffer>): void; | |
| 180 | 182 | function readlink(path: StringOrBuffer, encoding: unknown, req: undefined, ctx: FSSyncContext): string | Buffer; | |
| 181 | 183 | function readlink(path: StringOrBuffer, encoding: unknown, usePromises: typeof kUsePromises): Promise<string | Buffer>; | |
@@ -273,6 +275,7 @@ export interface FsBinding { | |||
| 273 | 275 | read: typeof InternalFSBinding.read; | |
| 274 | 276 | readBuffers: typeof InternalFSBinding.readBuffers; | |
| 275 | 277 | readdir: typeof InternalFSBinding.readdir; | |
| 278 | + readFileUtf8: typeof InternalFSBinding.readFileUtf8; | ||
| 276 | 279 | readlink: typeof InternalFSBinding.readlink; | |
| 277 | 280 | realpath: typeof InternalFSBinding.realpath; | |
| 278 | 281 | rename: typeof InternalFSBinding.rename; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments