or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

advanced-objects.mdbucket-operations.mdclient-setup.mdindex.mdnotifications.mdobject-operations.mdpresigned-operations.mdtypes-and-errors.md

types-and-errors.mddocs/

0

# Types and Errors

1

2

This document provides a comprehensive reference for all error classes, TypeScript interfaces, enums, and type definitions in the MinIO JavaScript client library.

3

4

## Error Classes

5

6

All error classes extend `ExtendableError`, which extends the native JavaScript `Error` class. Each error provides specific context for different failure scenarios.

7

8

### Error Class Hierarchy

9

10

```typescript { .api }

11

// Base error class (internal)

12

abstract class ExtendableError extends Error {

13

constructor(message?: string, opt?: ErrorOptions)

14

}

15

```

16

17

### Validation Errors

18

19

#### AnonymousRequestError

20

21

```typescript { .api }

22

class AnonymousRequestError extends ExtendableError {}

23

```

24

**Usage:** Generated for anonymous keys on APIs that require authentication. Presigned URL generation always requires access keys.

25

26

#### InvalidArgumentError

27

28

```typescript { .api }

29

class InvalidArgumentError extends ExtendableError {}

30

```

31

**Usage:** Generated for all invalid arguments passed to methods.

32

33

#### InvalidPortError

34

35

```typescript { .api }

36

class InvalidPortError extends ExtendableError {}

37

```

38

**Usage:** Generated when a non-integer value is provided for port numbers.

39

40

#### InvalidEndpointError

41

42

```typescript { .api }

43

class InvalidEndpointError extends ExtendableError {}

44

```

45

**Usage:** Generated when an invalid endpoint value is provided that doesn't follow domain standards.

46

47

#### InvalidBucketNameError

48

49

```typescript { .api }

50

class InvalidBucketNameError extends ExtendableError {}

51

```

52

**Usage:** Generated for bucket names that don't follow AWS S3 specifications.

53

54

#### InvalidObjectNameError

55

56

```typescript { .api }

57

class InvalidObjectNameError extends ExtendableError {}

58

```

59

**Usage:** Generated for object names that don't follow AWS S3 specifications.

60

61

### Authentication Errors

62

63

#### AccessKeyRequiredError

64

65

```typescript { .api }

66

class AccessKeyRequiredError extends ExtendableError {}

67

```

68

**Usage:** Generated by signature methods when access key is not found.

69

70

#### SecretKeyRequiredError

71

72

```typescript { .api }

73

class SecretKeyRequiredError extends ExtendableError {}

74

```

75

**Usage:** Generated by signature methods when secret key is not found.

76

77

### Parameter Errors

78

79

#### ExpiresParamError

80

81

```typescript { .api }

82

class ExpiresParamError extends ExtendableError {}

83

```

84

**Usage:** Generated when expires parameter value is outside stipulated limits.

85

86

#### InvalidDateError

87

88

```typescript { .api }

89

class InvalidDateError extends ExtendableError {}

90

```

91

**Usage:** Generated for invalid date values.

92

93

#### InvalidPrefixError

94

95

```typescript { .api }

96

class InvalidPrefixError extends ExtendableError {}

97

```

98

**Usage:** Generated for invalid object prefixes.

99

100

#### InvalidBucketPolicyError

101

102

```typescript { .api }

103

class InvalidBucketPolicyError extends ExtendableError {}

104

```

105

**Usage:** Generated for invalid bucket policy configurations.

106

107

### Data Errors

108

109

#### IncorrectSizeError

110

111

```typescript { .api }

112

class IncorrectSizeError extends ExtendableError {}

113

```

114

**Usage:** Generated when read data size doesn't match the input size parameter.

115

116

#### InvalidXMLError

117

118

```typescript { .api }

119

class InvalidXMLError extends ExtendableError {}

120

```

121

**Usage:** Generated for unknown or malformed XML responses from the server.

122

123

### Server Errors

124

125

#### S3Error

126

127

```typescript { .api }

128

class S3Error extends ExtendableError {

129

code: string // S3 error code (e.g., 'NoSuchBucket', 'AccessDenied')

130

region?: string // AWS region where error occurred

131

}

132

```

133

**Usage:** Generated for errors returned from S3-compatible servers. Contains specific error codes and optional region information.

134

135

### Utility Errors

136

137

#### IsValidBucketNameError

138

139

```typescript { .api }

140

class IsValidBucketNameError extends ExtendableError {}

141

```

142

**Usage:** Generated during bucket name validation errors.

143

144

## Core Type Definitions

145

146

### Basic Types

147

148

#### Binary

149

150

```typescript { .api }

151

type Binary = string | Buffer

152

```

153

**Usage:** Represents data that can be either a string or Buffer.

154

155

#### Region

156

157

```typescript { .api }

158

type Region = string

159

```

160

**Usage:** AWS region identifier (e.g., 'us-east-1', 'eu-west-1').

161

162

#### Transport

163

164

```typescript { .api }

165

type Transport = Pick<typeof http, 'request'>

166

```

167

**Usage:** HTTP transport interface for custom request handling.

168

169

### Metadata Types

170

171

#### ObjectMetaData

172

173

```typescript { .api }

174

type ObjectMetaData = Record<string, string | number>

175

```

176

**Usage:** Object metadata where keys are metadata names and values are string or number.

177

178

#### ResponseHeader

179

180

```typescript { .api }

181

type ResponseHeader = Record<string, string>

182

```

183

**Usage:** HTTP response headers as key-value pairs.

184

185

#### RequestHeaders

186

187

```typescript { .api }

188

type RequestHeaders = Record<string, string | boolean | number | undefined>

189

```

190

**Usage:** HTTP request headers with various value types.

191

192

## Configuration Interfaces

193

194

### ClientOptions

195

196

```typescript { .api }

197

interface ClientOptions {

198

endPoint: string // MinIO server endpoint

199

accessKey?: string // Access key for authentication

200

secretKey?: string // Secret key for authentication

201

useSSL?: boolean // Use HTTPS (default: true for port 443)

202

port?: number // Server port

203

region?: Region // AWS region

204

transport?: Transport // Custom HTTP transport

205

sessionToken?: string // Temporary session token

206

partSize?: number // Multipart upload part size

207

pathStyle?: boolean // Use path-style URLs

208

credentialsProvider?: CredentialProvider // Dynamic credential provider

209

s3AccelerateEndpoint?: string // S3 transfer acceleration endpoint

210

transportAgent?: http.Agent // HTTP agent for connection pooling

211

}

212

```

213

214

### Bucket Options

215

216

#### MakeBucketOpt

217

218

```typescript { .api }

219

interface MakeBucketOpt {

220

ObjectLocking?: boolean // Enable object locking (cannot be changed later)

221

}

222

```

223

224

## Object Operation Interfaces

225

226

### Object Retrieval Options

227

228

#### GetObjectOpts

229

230

```typescript { .api }

231

interface GetObjectOpts {

232

versionId?: string // Specific version ID

233

SSECustomerAlgorithm?: string // Server-side encryption algorithm

234

SSECustomerKey?: string // Server-side encryption key

235

SSECustomerKeyMD5?: string // MD5 hash of encryption key

236

}

237

```

238

239

#### StatObjectOpts

240

241

```typescript { .api }

242

interface StatObjectOpts {

243

versionId?: string // Specific version ID

244

SSECustomerAlgorithm?: string // Server-side encryption algorithm

245

SSECustomerKey?: string // Server-side encryption key

246

SSECustomerKeyMD5?: string // MD5 hash of encryption key

247

}

248

```

249

250

### Object Metadata

251

252

#### ItemBucketMetadata

253

254

```typescript { .api }

255

interface ItemBucketMetadata {

256

[key: string]: any // Custom metadata and HTTP headers

257

}

258

```

259

260

#### ItemBucketMetadataList

261

262

```typescript { .api }

263

interface ItemBucketMetadataList {

264

Items: MetadataItem[]

265

}

266

267

interface MetadataItem {

268

Key: string // Metadata key

269

Value: string // Metadata value

270

}

271

```

272

273

### Object Information

274

275

#### BucketItemStat

276

277

```typescript { .api }

278

interface BucketItemStat {

279

size: number // Object size in bytes

280

etag: string // Object ETag

281

lastModified: Date // Last modified timestamp

282

metaData: ResponseHeader // Object metadata and headers

283

versionId?: string // Version ID (if versioning enabled)

284

isDeleteMarker?: boolean // True if this is a delete marker

285

}

286

```

287

288

#### ObjectInfo

289

290

```typescript { .api }

291

interface ObjectInfo {

292

name: string // Object name/key

293

prefix?: string // Object prefix (for grouped results)

294

size: number // Object size in bytes

295

etag?: string // Object ETag

296

lastModified: Date // Last modified timestamp

297

storageClass?: string // Storage class

298

isDir?: boolean // True if this represents a directory

299

}

300

```

301

302

#### BucketItemFromList

303

304

```typescript { .api }

305

interface BucketItemFromList {

306

name: string // Bucket name

307

creationDate: Date // Bucket creation timestamp

308

}

309

```

310

311

### Object Operations Results

312

313

#### UploadedObjectInfo

314

315

```typescript { .api }

316

interface UploadedObjectInfo {

317

etag: string // Object ETag after upload

318

versionId?: string // Version ID (if versioning enabled)

319

}

320

```

321

322

#### CopyObjectResult

323

324

```typescript { .api }

325

interface CopyObjectResult {

326

etag: string // Copied object ETag

327

lastModified: Date // Last modified timestamp

328

versionId?: string // Version ID (if versioning enabled)

329

}

330

```

331

332

## Delete Operations

333

334

### RemoveOptions

335

336

```typescript { .api }

337

interface RemoveOptions {

338

versionId?: string // Specific version to delete

339

governanceBypass?: boolean // Bypass governance retention

340

}

341

```

342

343

### RemoveObjectsParam

344

345

```typescript { .api }

346

type RemoveObjectsParam = string[] | RemoveObjectsRequestEntry[]

347

348

interface RemoveObjectsRequestEntry {

349

name: string // Object name

350

versionId?: string // Version ID (optional)

351

}

352

```

353

354

### RemoveObjectsResponse

355

356

```typescript { .api }

357

interface RemoveObjectsResponse {

358

name?: string // Object name

359

versionId?: string // Version ID

360

deleteMarker?: boolean // True if delete marker created

361

deleteMarkerVersionId?: string // Delete marker version ID

362

363

// Error information (if deletion failed)

364

errorCode?: string // Error code

365

errorMessage?: string // Error message

366

}

367

```

368

369

## Copy Operations Interfaces

370

371

### ICopySourceOptions

372

373

```typescript { .api }

374

interface ICopySourceOptions {

375

Bucket: string // Source bucket name

376

Object: string // Source object name

377

VersionID?: string // Source version ID

378

MatchETag?: string // Copy only if ETag matches

379

NoMatchETag?: string // Copy only if ETag doesn't match

380

MatchModifiedSince?: string | null // Copy if modified since date

381

MatchUnmodifiedSince?: string | null // Copy if unmodified since date

382

MatchRange?: boolean // Enable byte range matching

383

Start?: number // Start byte for range

384

End?: number // End byte for range

385

Encryption?: Encryption // Source object encryption

386

}

387

```

388

389

### ICopyDestinationOptions

390

391

```typescript { .api }

392

interface ICopyDestinationOptions {

393

Bucket: string // Destination bucket name

394

Object: string // Destination object name

395

Encryption?: Encryption // Destination object encryption

396

UserMetadata?: ObjectMetaData // Custom metadata

397

UserTags?: Record<string, string> | string // Object tags

398

LegalHold?: 'on' | 'off' // Legal hold status

399

RetainUntilDate?: string // Retention until date

400

Mode?: RETENTION_MODES // Retention mode

401

MetadataDirective?: 'COPY' | 'REPLACE' // Metadata handling

402

Headers?: Record<string, string> // Additional headers

403

}

404

```

405

406

## Encryption Types

407

408

### Encryption Interface

409

410

```typescript { .api }

411

type Encryption =

412

| {

413

type: ENCRYPTION_TYPES.SSEC // Server-side encryption with customer keys

414

SSECustomerKey?: string // Base64 encoded 256-bit key

415

SSECustomerKeyMD5?: string // MD5 hash of the key

416

}

417

| {

418

type: ENCRYPTION_TYPES.KMS // Server-side encryption with KMS

419

SSEAlgorithm?: string // Encryption algorithm

420

KMSMasterKeyID?: string // KMS key ID

421

}

422

```

423

424

### ENCRYPTION_TYPES Enum

425

426

```typescript { .api }

427

enum ENCRYPTION_TYPES {

428

/**

429

* SSEC represents server-side-encryption with customer provided keys

430

*/

431

SSEC = 'SSE-C',

432

433

/**

434

* KMS represents server-side-encryption with managed keys

435

*/

436

KMS = 'KMS'

437

}

438

```

439

440

## Retention and Legal Hold

441

442

### RETENTION_MODES Enum

443

444

```typescript { .api }

445

enum RETENTION_MODES {

446

GOVERNANCE = 'GOVERNANCE', // Can be bypassed with proper permissions

447

COMPLIANCE = 'COMPLIANCE' // Cannot be bypassed or shortened

448

}

449

```

450

451

### RETENTION_VALIDITY_UNITS Enum

452

453

```typescript { .api }

454

enum RETENTION_VALIDITY_UNITS {

455

DAYS = 'Days', // Retention period in days

456

YEARS = 'Years' // Retention period in years

457

}

458

```

459

460

### LEGAL_HOLD_STATUS Enum

461

462

```typescript { .api }

463

enum LEGAL_HOLD_STATUS {

464

ENABLED = 'ON', // Legal hold is active

465

DISABLED = 'OFF' // Legal hold is inactive

466

}

467

```

468

469

### Retention Interfaces

470

471

#### ObjectRetentionInfo

472

473

```typescript { .api }

474

interface ObjectRetentionInfo {

475

mode: RETENTION_MODES // Retention mode

476

retainUntilDate: Date // Retention expiry date

477

}

478

```

479

480

#### Retention

481

482

```typescript { .api }

483

interface Retention {

484

mode: RETENTION_MODES // Retention mode

485

retainUntilDate: Date // Retention until date

486

governanceBypass?: boolean // Bypass governance retention (requires permission)

487

}

488

```

489

490

#### GetObjectRetentionOpts

491

492

```typescript { .api }

493

interface GetObjectRetentionOpts {

494

versionId?: string // Specific version ID

495

}

496

```

497

498

### Legal Hold Interfaces

499

500

#### GetObjectLegalHoldOptions

501

502

```typescript { .api }

503

interface GetObjectLegalHoldOptions {

504

versionId?: string // Specific version ID

505

}

506

```

507

508

#### PutObjectLegalHoldOptions

509

510

```typescript { .api }

511

interface PutObjectLegalHoldOptions {

512

versionId?: string // Specific version ID

513

status: LEGAL_HOLD_STATUS // Legal hold status (ON/OFF)

514

}

515

```

516

517

## Tagging Interfaces

518

519

### Tag

520

521

```typescript { .api }

522

interface Tag {

523

Key: string // Tag key

524

Value: string // Tag value

525

}

526

```

527

528

### Tags

529

530

```typescript { .api }

531

type Tags = Record<string, string> | Tag[] | TagList

532

533

interface TagList {

534

TagSet: Tag[]

535

}

536

```

537

538

### TaggingOpts

539

540

```typescript { .api }

541

interface TaggingOpts {

542

versionId?: string // Specific version ID

543

}

544

```

545

546

## Listing and Query Options

547

548

### ListObjectQueryOpts

549

550

```typescript { .api }

551

interface ListObjectQueryOpts {

552

delimiter?: string // Delimiter for grouping objects

553

encodingType?: string // Encoding type for object keys

554

maxKeys?: number // Maximum number of objects to return

555

prefix?: string // Object prefix filter

556

}

557

```

558

559

## S3 Select Types

560

561

### SelectOptions

562

563

```typescript { .api }

564

interface SelectOptions {

565

expression: string // SQL-like query expression

566

expressionType: 'SQL' // Query language (currently only SQL)

567

inputSerialization: { // Input format configuration

568

CSV?: {

569

FileHeaderInfo?: 'USE' | 'IGNORE' | 'NONE'

570

RecordDelimiter?: string // Record separator

571

FieldDelimiter?: string // Field separator

572

QuoteCharacter?: string // Quote character

573

QuoteEscapeCharacter?: string // Quote escape character

574

Comments?: string // Comment prefix

575

AllowQuotedRecordDelimiter?: boolean

576

}

577

JSON?: {

578

Type: 'DOCUMENT' | 'LINES' // JSON format type

579

}

580

Parquet?: {} // Parquet format

581

CompressionType?: 'NONE' | 'GZIP' | 'BZIP2' // Compression type

582

}

583

outputSerialization: { // Output format configuration

584

CSV?: {

585

RecordDelimiter?: string // Record separator

586

FieldDelimiter?: string // Field separator

587

QuoteCharacter?: string // Quote character

588

QuoteEscapeCharacter?: string // Quote escape character

589

QuoteFields?: 'ALWAYS' | 'ASNEEDED' // When to quote fields

590

}

591

JSON?: {

592

RecordDelimiter?: string // Record separator

593

}

594

}

595

requestProgress?: boolean // Include progress information

596

}

597

```

598

599

## Bucket Configuration Types

600

601

### BucketVersioningConfiguration

602

603

```typescript { .api }

604

interface BucketVersioningConfiguration {

605

Status?: 'Enabled' | 'Suspended' // Versioning status

606

MfaDelete?: 'Enabled' | 'Disabled' // MFA delete requirement

607

}

608

```

609

610

### EncryptionConfig

611

612

```typescript { .api }

613

interface EncryptionConfig {

614

Rule: EncryptionRule[]

615

}

616

617

interface EncryptionRule {

618

ApplyServerSideEncryptionByDefault: {

619

SSEAlgorithm: 'AES256' | 'aws:kms' // Encryption algorithm

620

KMSMasterKeyID?: string // KMS key ID (for KMS encryption)

621

}

622

}

623

```

624

625

### ObjectLockInfo

626

627

```typescript { .api }

628

interface ObjectLockInfo {

629

objectLockEnabled: 'Enabled' | 'Disabled' // Object lock status

630

rule?: { // Default retention rule

631

defaultRetention: {

632

mode: RETENTION_MODES // Governance or Compliance

633

days?: number // Retention period in days

634

years?: number // Retention period in years

635

validity?: RETENTION_VALIDITY_UNITS // DAYS or YEARS

636

}

637

}

638

}

639

```

640

641

## Lifecycle Configuration

642

643

### LifeCycleConfigParam

644

645

```typescript { .api }

646

interface LifeCycleConfigParam {

647

Rule: LifecycleRule[]

648

}

649

650

interface LifecycleRule {

651

ID?: string // Rule identifier

652

Status: 'Enabled' | 'Disabled' // Rule status

653

Filter?: { // Object filter

654

Prefix?: string // Prefix filter

655

Tag?: Tag // Tag filter

656

And?: { // Multiple filters

657

Prefix?: string

658

Tags?: Tag[]

659

}

660

}

661

Expiration?: { // Object expiration

662

Days?: number // Days after creation

663

Date?: string // Specific date

664

ExpiredObjectDeleteMarker?: boolean

665

}

666

NoncurrentVersionExpiration?: { // Non-current version expiration

667

NoncurrentDays: number // Days after becoming non-current

668

}

669

AbortIncompleteMultipartUpload?: { // Cleanup incomplete uploads

670

DaysAfterInitiation: number // Days after upload initiation

671

}

672

Transition?: { // Storage class transition

673

Days?: number // Days after creation

674

Date?: string // Specific date

675

StorageClass: string // Target storage class

676

}

677

NoncurrentVersionTransition?: { // Non-current version transition

678

NoncurrentDays: number // Days after becoming non-current

679

StorageClass: string // Target storage class

680

}

681

}

682

```

683

684

## Replication Configuration

685

686

### ReplicationConfigOpts

687

688

```typescript { .api }

689

interface ReplicationConfigOpts {

690

Role: string // IAM role for replication

691

Rule: ReplicationRule[] // Replication rules

692

}

693

694

interface ReplicationRule {

695

ID?: string // Rule identifier

696

Status: 'Enabled' | 'Disabled' // Rule status

697

Priority?: number // Rule priority

698

DeleteMarkerReplication?: {

699

Status: 'Enabled' | 'Disabled'

700

}

701

Filter?: { // Object filter

702

Prefix?: string // Prefix filter

703

Tag?: Tag // Tag filter

704

And?: { // Multiple filters

705

Prefix?: string

706

Tags?: Tag[]

707

}

708

}

709

Destination: {

710

Bucket: string // Destination bucket ARN

711

StorageClass?: string // Storage class in destination

712

ReplicationTime?: { // Replication time control

713

Status: 'Enabled' | 'Disabled'

714

Time: { Minutes: number }

715

}

716

Metrics?: { // Replication metrics

717

Status: 'Enabled' | 'Disabled'

718

EventThreshold: { Minutes: number }

719

}

720

}

721

}

722

```

723

724

## Presigned Operations Types

725

726

### PreSignRequestParams

727

728

```typescript { .api }

729

interface PreSignRequestParams {

730

[key: string]: string | undefined

731

732

// Response override parameters

733

'response-content-type'?: string

734

'response-content-language'?: string

735

'response-expires'?: string

736

'response-cache-control'?: string

737

'response-content-disposition'?: string

738

'response-content-encoding'?: string

739

740

// Version selection

741

'versionId'?: string

742

}

743

```

744

745

### PostPolicyResult

746

747

```typescript { .api }

748

interface PostPolicyResult {

749

postURL: string // URL to POST to

750

formData: Record<string, string> // Form fields to include in POST

751

}

752

```

753

754

## Internal Types

755

756

### IRequest

757

758

```typescript { .api }

759

interface IRequest {

760

protocol: string // HTTP protocol

761

port?: number | string // Port number

762

method: string // HTTP method

763

path: string // Request path

764

headers: RequestHeaders // Request headers

765

}

766

```

767

768

### ICanonicalRequest

769

770

```typescript { .api }

771

type ICanonicalRequest = string // Canonical request string for signing

772

```

773

774

### IncompleteUploadedBucketItem

775

776

```typescript { .api }

777

interface IncompleteUploadedBucketItem {

778

key: string // Object key

779

uploadId: string // Upload ID

780

size: number // Current upload size

781

}

782

```

783

784

## Constants

785

786

### Helper Constants

787

788

```typescript { .api }

789

const DEFAULT_REGION: string = 'us-east-1'

790

const PRESIGN_EXPIRY_DAYS_MAX: number = 604800 // 7 days in seconds

791

```

792

793

### Status Types

794

795

```typescript { .api }

796

type EnabledOrDisabledStatus = 'Enabled' | 'Disabled'

797

```

798

799

### Version Identificator

800

801

```typescript { .api }

802

type VersionIdentificator = {

803

versionId?: string

804

}

805

```

806

807

## Usage Examples

808

809

### Error Handling Example

810

811

```javascript { .api }

812

import {

813

S3Error,

814

InvalidBucketNameError,

815

AccessKeyRequiredError,

816

ExpiresParamError

817

} from 'minio'

818

819

try {

820

await client.makeBucket('invalid..bucket..name')

821

} catch (error) {

822

if (error instanceof InvalidBucketNameError) {

823

console.error('Invalid bucket name:', error.message)

824

} else if (error instanceof S3Error) {

825

console.error(`S3 Error [${error.code}]:`, error.message)

826

if (error.region) {

827

console.error('Region:', error.region)

828

}

829

} else {

830

console.error('Unexpected error:', error)

831

}

832

}

833

```

834

835

### Type-Safe Configuration

836

837

```javascript { .api }

838

import {

839

ClientOptions,

840

ENCRYPTION_TYPES,

841

RETENTION_MODES,

842

LEGAL_HOLD_STATUS

843

} from 'minio'

844

845

// Type-safe client configuration

846

const clientConfig: ClientOptions = {

847

endPoint: 'play.min.io',

848

port: 9000,

849

useSSL: true,

850

accessKey: 'access-key',

851

secretKey: 'secret-key',

852

region: 'us-east-1',

853

pathStyle: false

854

}

855

856

// Type-safe encryption configuration

857

const encryption: Encryption = {

858

type: ENCRYPTION_TYPES.SSEC,

859

SSECustomerKey: 'your-32-character-key-here!!!!!!',

860

SSECustomerKeyMD5: 'md5-hash-of-key'

861

}

862

863

// Type-safe retention configuration

864

const retention: Retention = {

865

mode: RETENTION_MODES.GOVERNANCE,

866

retainUntilDate: new Date('2024-01-01'),

867

governanceBypass: false

868

}

869

```

870

871

## Utility Functions

872

873

### removeDirAndFiles (Deprecated)

874

875

```typescript { .api }

876

function removeDirAndFiles(dirPath: string, removeSelf?: boolean): void

877

```

878

879

**Usage:** Removes a directory and all its contents.

880

881

**Parameters:**

882

- `dirPath: string` - Path to the directory to remove

883

- `removeSelf?: boolean` - Whether to remove the directory itself (default: true)

884

885

**Note:** This function is deprecated. Use Node.js `fs` module methods like `fs.rmSync()` instead.

886

887

**Example:**

888

```javascript { .api }

889

import { removeDirAndFiles } from 'minio'

890

891

// ⚠️ Deprecated - use fs.rmSync instead

892

removeDirAndFiles('/path/to/temp/dir', true)

893

894

// ✅ Recommended approach

895

import * as fs from 'node:fs'

896

fs.rmSync('/path/to/temp/dir', { recursive: true, force: true })

897

```

898

899

This comprehensive type reference covers all interfaces, enums, error classes, and type definitions available in the MinIO JavaScript client library, providing complete type safety and documentation for TypeScript development.

900

901

---

902

903

**Related Documentation:**

904

- [Client Setup](./client-setup.md) - Client configuration and initialization

905

- [Object Operations](./object-operations.md) - Basic object operations using these types

906

- [Advanced Objects](./advanced-objects.md) - Advanced features using complex types

907

- [Bucket Operations](./bucket-operations.md) - Bucket management with configuration types