@file-services/types
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,2 +0,2 @@ | ||
import { IFileSystemStats, BufferEncoding, CallbackFnVoid, CallbackFn, WriteFileOptions, ReadFileOptions } from './common-fs-types'; | ||
import { IFileSystemStats, BufferEncoding, CallbackFnVoid, CallbackFn, WriteFileOptions, ReadFileOptions, IDirectoryEntry } from './common-fs-types'; | ||
import { IFileSystemPath } from './path'; | ||
@@ -50,2 +50,9 @@ import { IWatchService } from './watch-api'; | ||
readdir(directoryPath: string, callback: CallbackFn<string[]>): void; | ||
readdir(directoryPath: string, options: { | ||
encoding?: BufferEncoding | null; | ||
withFileTypes?: false; | ||
} | BufferEncoding | null | undefined, callback: CallbackFn<string[]>): void; | ||
readdir(directoryPath: string, options: { | ||
withFileTypes: true; | ||
}, callback: CallbackFn<IDirectoryEntry[]>): void; | ||
/** | ||
@@ -120,3 +127,9 @@ * Create a directory. | ||
*/ | ||
readdir(directoryPath: string): Promise<string[]>; | ||
readdir(directoryPath: string, options?: { | ||
encoding?: BufferEncoding | null; | ||
withFileTypes?: false; | ||
} | BufferEncoding | null): Promise<string[]>; | ||
readdir(directoryPath: string, options: { | ||
withFileTypes: true; | ||
}): Promise<IDirectoryEntry[]>; | ||
/** | ||
@@ -123,0 +136,0 @@ * Create a directory. |
@@ -1,2 +0,2 @@ | ||
import { IFileSystemStats, BufferEncoding, WriteFileOptions, ReadFileOptions } from './common-fs-types'; | ||
import { IFileSystemStats, BufferEncoding, WriteFileOptions, ReadFileOptions, IDirectoryEntry } from './common-fs-types'; | ||
import { IFileSystemPath } from './path'; | ||
@@ -58,3 +58,9 @@ import { IWatchService } from './watch-api'; | ||
*/ | ||
readdirSync(directoryPath: string): string[]; | ||
readdirSync(directoryPath: string, options?: { | ||
encoding?: BufferEncoding | null; | ||
withFileTypes?: false; | ||
} | BufferEncoding | null): string[]; | ||
readdirSync(directoryPath: string, options: { | ||
withFileTypes: true; | ||
}): IDirectoryEntry[]; | ||
/** | ||
@@ -61,0 +67,0 @@ * Create a new directory. |
@@ -30,2 +30,25 @@ export declare type BufferEncoding = 'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'base64' | 'latin1' | 'binary' | 'hex'; | ||
/** | ||
* Subset of the original `fs.Dirent` class. | ||
*/ | ||
export interface IDirectoryEntry { | ||
/** | ||
* Base name of the entry. | ||
* | ||
* @example `package.json` | ||
*/ | ||
name: string; | ||
/** | ||
* Whether the entry points to a file. | ||
*/ | ||
isFile(): boolean; | ||
/** | ||
* Whether the entry points to a directory. | ||
*/ | ||
isDirectory(): boolean; | ||
/** | ||
* Whether the entry is a symbolic link. | ||
*/ | ||
isSymbolicLink(): boolean; | ||
} | ||
/** | ||
* Subset of the original `fs.Stats` interface | ||
@@ -32,0 +55,0 @@ */ |
{ | ||
"name": "@file-services/types", | ||
"description": "Common file system interfaces", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "cjs/index.js", | ||
@@ -24,3 +24,3 @@ "types": "cjs/index.d.ts", | ||
"sideEffects": false, | ||
"gitHead": "fdcdf94689d021a2ed845fd1e68d09759892efc2" | ||
"gitHead": "5324bae9c23054284cb0727692dae2b6a1cb1560" | ||
} |
@@ -7,3 +7,4 @@ import { | ||
WriteFileOptions, | ||
ReadFileOptions | ||
ReadFileOptions, | ||
IDirectoryEntry | ||
} from './common-fs-types'; | ||
@@ -67,2 +68,8 @@ import { IFileSystemPath } from './path'; | ||
readdir(directoryPath: string, callback: CallbackFn<string[]>): void; | ||
readdir( | ||
directoryPath: string, | ||
options: { encoding?: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null | undefined, | ||
callback: CallbackFn<string[]> | ||
): void; | ||
readdir(directoryPath: string, options: { withFileTypes: true }, callback: CallbackFn<IDirectoryEntry[]>): void; | ||
@@ -144,3 +151,7 @@ /** | ||
*/ | ||
readdir(directoryPath: string): Promise<string[]>; | ||
readdir( | ||
directoryPath: string, | ||
options?: { encoding?: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null | ||
): Promise<string[]>; | ||
readdir(directoryPath: string, options: { withFileTypes: true }): Promise<IDirectoryEntry[]>; | ||
@@ -147,0 +158,0 @@ /** |
@@ -1,2 +0,8 @@ | ||
import { IFileSystemStats, BufferEncoding, WriteFileOptions, ReadFileOptions } from './common-fs-types'; | ||
import { | ||
IFileSystemStats, | ||
BufferEncoding, | ||
WriteFileOptions, | ||
ReadFileOptions, | ||
IDirectoryEntry | ||
} from './common-fs-types'; | ||
import { IFileSystemPath } from './path'; | ||
@@ -60,3 +66,7 @@ import { IWatchService } from './watch-api'; | ||
*/ | ||
readdirSync(directoryPath: string): string[]; | ||
readdirSync( | ||
directoryPath: string, | ||
options?: { encoding?: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null | ||
): string[]; | ||
readdirSync(directoryPath: string, options: { withFileTypes: true }): IDirectoryEntry[]; | ||
@@ -63,0 +73,0 @@ /** |
@@ -36,2 +36,29 @@ export type BufferEncoding = 'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'base64' | 'latin1' | 'binary' | 'hex'; | ||
/** | ||
* Subset of the original `fs.Dirent` class. | ||
*/ | ||
export interface IDirectoryEntry { | ||
/** | ||
* Base name of the entry. | ||
* | ||
* @example `package.json` | ||
*/ | ||
name: string; | ||
/** | ||
* Whether the entry points to a file. | ||
*/ | ||
isFile(): boolean; | ||
/** | ||
* Whether the entry points to a directory. | ||
*/ | ||
isDirectory(): boolean; | ||
/** | ||
* Whether the entry is a symbolic link. | ||
*/ | ||
isSymbolicLink(): boolean; | ||
} | ||
/** | ||
* Subset of the original `fs.Stats` interface | ||
@@ -38,0 +65,0 @@ */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66498
1386