# FUNCTION DUMP

> Serialize all loaded function libraries into a payload for FUNCTION RESTORE.

URL: https://docs.hotkv.com/commands/function-dump/

```
FUNCTION DUMP
```

- Group: Scripting and functions
- Complexity: O(N) where N is the number of libraries
- HotKV Cloud: all plans
- On-Premise: no license needed

`FUNCTION DUMP` returns all loaded libraries as one binary payload. Pass it to
[FUNCTION RESTORE](https://docs.hotkv.com/commands/function-restore/index.md), on this server or another
HotKV server, to load the same libraries there. The payload holds the source
code of each library, so restoring it compiles them again. With no libraries
loaded, the payload is an empty string.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Always | Bulk string: the payload | Bulk string |

## Examples

```
127.0.0.1:6379> FUNCTION LOAD "#!lua name=util\nredis.register_function('echo', function(keys, args) return args[1] end)"
"util"
127.0.0.1:6379> FUNCTION DUMP
"#!lua name=util\nredis.register_function('echo', function(keys, args) return args[1] end)\x00"
```

## Compatibility

The payload format is HotKV's own. A payload from Redis or Valkey cannot be
restored on HotKV and the other way round; to move libraries between them, load
the source code with [FUNCTION LOAD](https://docs.hotkv.com/commands/function-load/index.md) (you can get it
from `FUNCTION LIST WITHCODE`).

## See also

[FUNCTION RESTORE](https://docs.hotkv.com/commands/function-restore/index.md),
[FUNCTION LIST](https://docs.hotkv.com/commands/function-list/index.md)