Skip to content

Commit e94e919

Browse files
authored
PHP: Add listFiles options to IsomorphicLocalPHP and WebPHPEndpoint (#490)
The options argument for listFiles was added to BasePHP in #462. This commit adds it to an interface and a Web PHP Endpoint so that it can be used across the board in web and node.js applications
1 parent ca035ca commit e94e919

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

packages/php-wasm/universal/src/lib/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export type {
55
PHPOutput,
66
PHPRunOptions,
77
UniversalPHP,
8+
ListFilesOptions,
89
RmDirOptions,
910
HTTPMethod,
1011
PHPRequest,

packages/php-wasm/universal/src/lib/universal-php.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,10 @@ export interface IsomorphicLocalPHP extends RequestHandler {
222222
* Lists the files and directories in the given directory.
223223
*
224224
* @param path - The directory path to list.
225+
* @param options - Options for the listing.
225226
* @returns The list of files and directories in the given directory.
226227
*/
227-
listFiles(path: string): string[];
228+
listFiles(path: string, options?: ListFilesOptions): string[];
228229

229230
/**
230231
* Checks if a directory exists in the PHP filesystem.

packages/php-wasm/web/src/lib/web-php-endpoint.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type {
22
BasePHP,
33
IsomorphicLocalPHP,
4+
ListFilesOptions,
45
PHPRequest,
56
PHPResponse,
67
PHPRunOptions,
@@ -145,8 +146,8 @@ export class WebPHPEndpoint implements IsomorphicLocalPHP {
145146
}
146147

147148
/** @inheritDoc @php-wasm/web!WebPHP.listFiles */
148-
listFiles(path: string): string[] {
149-
return _private.get(this)!.php.listFiles(path);
149+
listFiles(path: string, options?: ListFilesOptions): string[] {
150+
return _private.get(this)!.php.listFiles(path, options);
150151
}
151152

152153
/** @inheritDoc @php-wasm/web!WebPHP.isDir */

0 commit comments

Comments
 (0)