Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions src/node/internal/internal_fs_callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import {
ERR_INVALID_ARG_VALUE,
ERR_UNSUPPORTED_OPERATION,
} from 'node-internal:internal_errors';
import { type Dir } from 'node-internal:internal_fs';
import { type Dir, Dirent } from 'node-internal:internal_fs';
import { Buffer } from 'node-internal:internal_buffer';
import { isArrayBufferView } from 'node-internal:internal_types';
import {
Expand Down Expand Up @@ -1416,18 +1416,26 @@ export function watchFile(): void {
}

export function glob(
_pattern: string | readonly string[],
_options:
pattern: string | readonly string[],
optionsOrCallback:
| GlobOptions
| GlobOptionsWithFileTypes
| GlobOptionsWithoutFileTypes,
_callback: ErrorOnlyCallback
| GlobOptionsWithoutFileTypes
| SingleArgCallback<string[] | Dirent[]>,
callback?: SingleArgCallback<string[] | Dirent[]>
): void {
// We do not yet implement the globSync function. In Node.js, this
// function depends heavily on the third party minimatch library
// which is not yet available in the workers runtime. This will be
// explored for implementation separately in the future.
throw new ERR_UNSUPPORTED_OPERATION();
let options:
| GlobOptions
| GlobOptionsWithFileTypes
| GlobOptionsWithoutFileTypes;
if (typeof optionsOrCallback === 'function') {
callback = optionsOrCallback;
options = {};
} else {
options = optionsOrCallback;
}
if (callback === undefined) return;
callWithSingleArgCallback(() => fssync.globSync(pattern, options), callback);
}

// An API is considered stubbed if it is not implemented by the function
Expand Down Expand Up @@ -1497,5 +1505,5 @@ export function glob(
// [ ][ ][ ][ ] fs.createReadStream(path[, options])
// [ ][ ][ ][ ] fs.createWriteStream(path[, options])
//
// [ ][ ][ ][ ] fs.glob(pattern[, options], callback)
// [x][x][x][x] fs.glob(pattern[, options], callback)
// [ ][ ][ ][ ] fs.openAsBlob(path[, options])
Loading
Loading