---
name: "File::KDBX::Dumper"
section: "3pm"
platform: "linux"
package: "libfile-kdbx-perl"
version: "0.906-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/File::KDBX::Dumper"
---

# File::KDBX::Dumper(3pm)

Write KDBX files

## NAME

File::KDBX::Dumper - Write KDBX files

## VERSION

version 0.906

## ATTRIBUTES

### kdbx

```
    $kdbx = $dumper->kdbx;
    $dumper->kdbx($kdbx);
```

Get or set the File::KDBX instance with the data to be dumped.

### format

Get the file format used for writing the database. Normally the format is auto-detected from the database, which is the safest choice. Possible formats:

- •

  `"V3"`

- •

  `"V4"`

- •

  `"KDB"`

- •

  `"XML"` (only used if explicitly set)

- •

  `"Raw"` (only used if explicitly set)

**WARNING:** There is a potential for data loss if you explicitly use a format that doesn't support the features used by the KDBX database being written.

The most common reason to explicitly specify the file format is to save a database as an unencrypted XML file:

```
    $kdbx->dump_file('database.xml', format => 'XML');
```

### inner\_format

Get the format of the data inside the KDBX envelope. This only applies to `"V3"` and `"V4"` formats. Possible formats:

- •

  `"XML"` - Write the database groups and entries as XML (default)

- •

  `"Raw"` - Write "raw" in File::KDBX instead of the actual database contents

### allow\_upgrade

```
    $bool = $dumper->allow_upgrade;
```

Whether or not to allow implicitly upgrading a database to a newer version. When enabled, in order to avoid potential data loss, the database can be upgraded as-needed in cases where the database file format version is too low to support new features being used.

The default is to allow upgrading.

### randomize\_seeds

```
    $bool = $dumper->randomize_seeds;
```

Whether or not to randomize seeds in a database before writing. The default is to randomize seeds, and there's not often a good reason not to do so. If disabled, the seeds associated with the KDBX database will be used as they are.

## METHODS

### new

```
    $dumper = File::KDBX::Dumper->new(%attributes);
```

Construct a new File::KDBX::Dumper.

### init

```
    $dumper = $dumper->init(%attributes);
```

Initialize a File::KDBX::Dumper with a new set of attributes.

This is called by "new".

### reset

```
    $dumper = $dumper->reset;
```

Set a File::KDBX::Dumper to a blank state, ready to dump another KDBX file.

### dump

```
    $dumper->dump(\$string, %options);
    $dumper->dump(\$string, $key, %options);
    $dumper->dump(*IO, %options);
    $dumper->dump(*IO, $key, %options);
    $dumper->dump($filepath, %options);
    $dumper->dump($filepath, $key, %options);
```

Dump a KDBX file.

The `$key` is either a File::KDBX::Key or a primitive castable to a Key object. Available options:

- •

  `"kdbx"` - Database to dump (default: value of "kdbx")

- •

  `"key"` - Alternative way to specify `$key` (default: value of "File::KDBX/key")

Other options are supported depending on the first argument. See "dump\_string", "dump\_file" and "dump\_handle".

### dump\_string

```
    $dumper->dump_string(\$string, %options);
    $dumper->dump_string(\$string, $key, %options);
    \$string = $dumper->dump_string(%options);
    \$string = $dumper->dump_string($key, %options);
```

Dump a KDBX file to a string / memory buffer. Available options:

- •

  `"kdbx"` - Database to dump (default: value of "kdbx")

- •

  `"key"` - Alternative way to specify `$key` (default: value of "File::KDBX/key")

### dump\_file

```
    $dumper->dump_file($filepath, %options);
    $dumper->dump_file($filepath, $key, %options);
```

Dump a KDBX file to a filesystem. Available options:

- •

  `"kdbx"` - Database to dump (default: value of "kdbx")

- •

  `"key"` - Alternative way to specify `$key` (default: value of "File::KDBX/key")

- •

  `"mode"` - File mode / permissions (see "chmod LIST" in perlfunc

- •

  `"uid"` - User ID (see "chown LIST" in perlfunc)

- •

  `"gid"` - Group ID (see "chown LIST" in perlfunc)

- •

  `"atomic"` - Write to the filepath atomically (default: true)

### dump\_handle

```
    $dumper->dump_handle($fh, %options);
    $dumper->dump_handle(*IO, $key, %options);
    $dumper->dump_handle($fh, %options);
    $dumper->dump_handle(*IO, $key, %options);
```

Dump a KDBX file to an output stream / file handle. Available options:

- •

  `"kdbx"` - Database to dump (default: value of "kdbx")

- •

  `"key"` - Alternative way to specify `$key` (default: value of "File::KDBX/key")

## BUGS

Please report any bugs or feature requests on the bugtracker website \<https://github.com/chazmcgarvey/File-KDBX/issues\>

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

## AUTHOR

Charles McGarvey \<ccm@cpan.org\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Charles McGarvey.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
