Skip to content
Merged
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
3 changes: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

### New Features

* **Added `ConvertFrom-ByteArrayToString`** - Converts byte arrays to strings with encoding support (Issue #15)
* Supports ASCII, BigEndianUnicode, Default, Unicode, UTF32, and UTF8 encodings
* Inverse operation of `ConvertFrom-StringToByteArray`
* **Added `-Encoding` parameter** to `ConvertFrom-MemoryStreamToString` (Issue #21)
* **Added `-Encoding` parameter** to `ConvertFrom-MemoryStreamToSecureString` (Issue #21)
* **Added pipeline support** to `ConvertFrom-Base64ToByteArray` (Issue #16)
Expand Down
25 changes: 15 additions & 10 deletions docs/functions/ConvertFrom-Base64ToByteArray.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: Convert-help.xml
Module Name: Convert
online version: https://msdn.microsoft.com/en-us/library/system.convert.frombase64string%28v=vs.110%29.aspx
online version: https://austoonz.github.io/Convert/functions/ConvertFrom-Base64ToByteArray/
schema: 2.0.0
---

Expand All @@ -13,7 +13,7 @@ Converts a Base 64 Encoded String to a Byte Array
## SYNTAX

```
ConvertFrom-Base64ToByteArray [-String] <String> [-ProgressAction <ActionPreference>] [<CommonParameters>]
ConvertFrom-Base64ToByteArray [-String] <String[]> [-ProgressAction <ActionPreference>] [<CommonParameters>]
```

## DESCRIPTION
Expand All @@ -24,28 +24,32 @@ Converts a Base 64 Encoded String to a Byte Array
### EXAMPLE 1
```
ConvertFrom-Base64ToByteArray -String 'dGVzdA=='
116
101
115
116
```

Converts the base64 string to its byte array representation.
### EXAMPLE 2
```
'SGVsbG8=' | ConvertFrom-Base64ToByteArray
```

### EXAMPLE 3
```
'SGVsbG8=', 'V29ybGQ=' | ConvertFrom-Base64ToByteArray
```

## PARAMETERS

### -String
The Base 64 Encoded String to be converted

```yaml
Type: String
Type: String[]
Parameter Sets: (All)
Aliases: Base64String

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```

Expand All @@ -71,9 +75,10 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### [Byte[]]
## NOTES

## RELATED LINKS

[https://msdn.microsoft.com/en-us/library/system.convert.frombase64string%28v=vs.110%29.aspx](https://msdn.microsoft.com/en-us/library/system.convert.frombase64string%28v=vs.110%29.aspx)
[https://austoonz.github.io/Convert/functions/ConvertFrom-Base64ToByteArray/](https://austoonz.github.io/Convert/functions/ConvertFrom-Base64ToByteArray/)

15 changes: 9 additions & 6 deletions docs/functions/ConvertFrom-ByteArrayToMemoryStream.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: Convert-help.xml
Module Name: Convert
online version: https://msdn.microsoft.com/en-us/library/system.io.memorystream(v=vs.110).aspx
online version: https://austoonz.github.io/Convert/functions/ConvertFrom-ByteArrayToMemoryStream/
schema: 2.0.0
---

Expand All @@ -27,7 +27,11 @@ Converts a Byte Array to a MemoryStream
ConvertFrom-ByteArrayToMemoryStream -ByteArray ([Byte[]] (,0xFF * 100))
```

This command uses the ConvertFrom-ByteArrayToMemoryStream cmdlet to convert a Byte Array into a Memory Stream.
### EXAMPLE 2
```
$bytes = [Byte[]]@(72, 101, 108, 108, 111)
,$bytes | ConvertFrom-ByteArrayToMemoryStream
```

## PARAMETERS

Expand All @@ -42,7 +46,7 @@ Aliases: Bytes
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```

Expand All @@ -68,11 +72,10 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### [System.IO.MemoryStream[]]
## NOTES
Additional information:
https://msdn.microsoft.com/en-us/library/63z365ty(v=vs.110).aspx

## RELATED LINKS

[https://msdn.microsoft.com/en-us/library/system.io.memorystream(v=vs.110).aspx](https://msdn.microsoft.com/en-us/library/system.io.memorystream(v=vs.110).aspx)
[https://austoonz.github.io/Convert/functions/ConvertFrom-ByteArrayToMemoryStream/](https://austoonz.github.io/Convert/functions/ConvertFrom-ByteArrayToMemoryStream/)

111 changes: 111 additions & 0 deletions docs/functions/ConvertFrom-ByteArrayToString.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
external help file: Convert-help.xml
Module Name: Convert
online version: https://austoonz.github.io/Convert/functions/ConvertFrom-ByteArrayToString/
schema: 2.0.0
---

# ConvertFrom-ByteArrayToString

## SYNOPSIS
Converts a byte array to a string using the specified encoding.

## SYNTAX

```
ConvertFrom-ByteArrayToString [-ByteArray] <Byte[]> [[-Encoding] <String>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
```

## DESCRIPTION
Converts a byte array to a string using the specified encoding.
This is the inverse operation of ConvertFrom-StringToByteArray.

## EXAMPLES

### EXAMPLE 1
```
$bytes = [byte[]]@(72, 101, 108, 108, 111)
ConvertFrom-ByteArrayToString -ByteArray $bytes
```

Hello

### EXAMPLE 2
```
$bytes = ConvertFrom-StringToByteArray -String 'Hello, World!'
ConvertFrom-ByteArrayToString -ByteArray $bytes
```

Hello, World!

### EXAMPLE 3
```
$bytes1, $bytes2 | ConvertFrom-ByteArrayToString -Encoding 'UTF8'
```

Converts multiple byte arrays from the pipeline to strings.

## PARAMETERS

### -ByteArray
The array of bytes to convert.

```yaml
Type: Byte[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```

### -Encoding
The encoding to use for conversion.
Defaults to UTF8.
Valid options are ASCII, BigEndianUnicode, Default, Unicode, UTF32, and UTF8.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: UTF8
Accept pipeline input: False
Accept wildcard characters: False
```

### -ProgressAction
{{ Fill ProgressAction Description }}

```yaml
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

### [String]
## NOTES

## RELATED LINKS

[https://austoonz.github.io/Convert/functions/ConvertFrom-ByteArrayToString/](https://austoonz.github.io/Convert/functions/ConvertFrom-ByteArrayToString/)

8 changes: 4 additions & 4 deletions docs/functions/ConvertFrom-MemoryStreamToSecureString.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Converts a Memory Stream to a Secure String

### MemoryStream (Default)
```
ConvertFrom-MemoryStreamToSecureString -MemoryStream <MemoryStream[]> [-Encoding <String>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
ConvertFrom-MemoryStreamToSecureString -MemoryStream <MemoryStream[]> [-Encoding <String>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
```

### Stream
```
ConvertFrom-MemoryStreamToSecureString -Stream <Stream[]> [-Encoding <String>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
ConvertFrom-MemoryStreamToSecureString -Stream <Stream[]> [-Encoding <String>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down
29 changes: 4 additions & 25 deletions docs/functions/ConvertFrom-MemoryStreamToString.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ Converts MemoryStream to a string.

## SYNTAX

### MemoryStream
```
ConvertFrom-MemoryStreamToString -MemoryStream <MemoryStream[]> [-Encoding <String>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
```

### Stream
```
ConvertFrom-MemoryStreamToString -Stream <Stream[]> [-Encoding <String>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
Expand Down Expand Up @@ -97,33 +90,19 @@ Another string

## PARAMETERS

### -MemoryStream
A System.IO.MemoryStream object for conversion.

```yaml
Type: MemoryStream[]
Parameter Sets: MemoryStream
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```

### -Stream
A System.IO.Stream object for conversion.
Accepts any stream type including MemoryStream, FileStream, etc.

```yaml
Type: Stream[]
Parameter Sets: Stream
Aliases:
Parameter Sets: (All)
Aliases: MemoryStream

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```

Expand Down
1 change: 1 addition & 0 deletions docs/functions/ConvertFrom-StringToByteArray.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ConvertFrom-StringToByteArray [-String] <String[]> [[-Encoding] <String>] [-Prog

## DESCRIPTION
Converts a string to a byte array object.
This is the inverse operation of ConvertFrom-ByteArrayToString.

## EXAMPLES

Expand Down
25 changes: 3 additions & 22 deletions docs/functions/ConvertTo-String.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ ConvertTo-String -Base64EncodedString <String[]> [-Encoding <String>] [-Decompre
[-ProgressAction <ActionPreference>] [<CommonParameters>]
```

### MemoryStream
```
ConvertTo-String -MemoryStream <MemoryStream[]> [-ProgressAction <ActionPreference>] [<CommonParameters>]
```

### Stream
```
ConvertTo-String -Stream <Stream[]> [-ProgressAction <ActionPreference>] [<CommonParameters>]
Expand Down Expand Up @@ -120,33 +115,19 @@ Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```

### -MemoryStream
A MemoryStream object for conversion.

```yaml
Type: MemoryStream[]
Parameter Sets: MemoryStream
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```

### -Stream
A System.IO.Stream object for conversion.
Accepts any stream type including MemoryStream, FileStream, etc.

```yaml
Type: Stream[]
Parameter Sets: Stream
Aliases:
Aliases: MemoryStream

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```

Expand Down
Loading
Loading