Home Explore Blog CI



nushell

commands/docs/bytes_add.md
43eefe091a9df7c4d131d3fb4386294060698780de2c797600000003000007db
---
title: bytes add
categories: |
  bytes
version: 0.104.0
bytes: |
  Add specified bytes to the input.
usage: |
  Add specified bytes to the input.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `bytes add` for [bytes](/commands/categories/bytes.md)

<div class='command-title'>Add specified bytes to the input.</div>

## Signature

```> bytes add {flags} (data) ...rest```

## Flags

 -  `--index, -i {int}`: index to insert binary data
 -  `--end, -e`: add to the end of binary

## Parameters

 -  `data`: The binary to add.
 -  `...rest`: For a data structure input, add bytes to the data at the given cell paths.


## Input/output types:

| input        | output       |
| ------------ | ------------ |
| binary       | binary       |
| list\<binary\> | list\<binary\> |
| record       | record       |
| table        | table        |
## Examples

Add bytes `0x[AA]` to `0x[1F FF AA AA]`
```nu
> 0x[1F FF AA AA] | bytes add 0x[AA]
Length: 5 (0x5) bytes | printable whitespace ascii_other non_ascii
00000000:   aa 1f ff aa  aa                                      ו×××

```

Add bytes `0x[AA BB]` to `0x[1F FF AA AA]` at index 1
```nu
> 0x[1F FF AA AA] | bytes add 0x[AA BB] --index 1
Length: 6 (0x6) bytes | printable whitespace ascii_other non_ascii
00000000:   1f aa bb ff  aa aa                                   •×××××

```

Add bytes `0x[11]` to `0x[FF AA AA]` at the end
```nu
> 0x[FF AA AA] | bytes add 0x[11] --end
Length: 4 (0x4) bytes | printable whitespace ascii_other non_ascii
00000000:   ff aa aa 11                                          ××ו

```

Add bytes `0x[11 22 33]` to `0x[FF AA AA]` at the end, at index 1(the index is start from end)
```nu
> 0x[FF AA BB] | bytes add 0x[11 22 33] --end --index 1
Length: 6 (0x6) bytes | printable whitespace ascii_other non_ascii
00000000:   ff aa 11 22  33 bb                                   ×ו"3×

```

Chunks
eca9ed3f (1st chunk of `commands/docs/bytes_add.md`)
Title: bytes add
Summary
The `bytes add` command adds specified bytes to the input. It can insert bytes at a specific index or at the end of the binary data. The command supports binary, list of binaries, record, and table inputs.