Import-Yaml¶
SYNOPSIS¶
Imports YAML documents from files.
SYNTAX¶
Path (Default)¶
powershell
Import-Yaml [-Path] <string[]> [-Encoding <string>] [-AsHashtable] [-NoEnumerate] [-Depth <int>]
[-MaxNodes <int>] [-MaxAliases <int>] [-MaxScalarLength <int>] [-MaxTagLength <int>]
[-MaxTotalTagLength <int>] [-MaxNumericLength <int>]
LiteralPath¶
powershell
Import-Yaml -LiteralPath <string[]> [-Encoding <string>] [-AsHashtable] [-NoEnumerate]
[-Depth <int>] [-MaxNodes <int>] [-MaxAliases <int>] [-MaxScalarLength <int>] [-MaxTagLength <int>]
[-MaxTotalTagLength <int>] [-MaxNumericLength <int>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
Resolves FileSystem files deterministically, decodes each file with a strict Unicode encoding, and delegates YAML parsing to ConvertFrom-Yaml. Wildcards are expanded only for Path. Duplicate resolved files are read once, and each file's documents retain their source order.
Byte order marks for UTF-8, UTF-16, and UTF-32 are detected automatically and override Encoding. Files without a byte order mark default to strict UTF-8.
EXAMPLES¶
EXAMPLE 1¶
Import-Yaml -Path '.\config.yaml'
Imports the YAML documents from config.yaml.
EXAMPLE 2¶
Get-ChildItem -Path '.\config' -Filter '*.yaml' | Import-Yaml -AsHashtable
Imports FileInfo pipeline input and returns mappings as dictionaries.
EXAMPLE 3¶
Import-Yaml -LiteralPath '.\config[production].data' -NoEnumerate
Imports a literal wildcard-bearing filename and preserves root arrays.
PARAMETERS¶
-AsHashtable¶
Preserves YAML mappings as insertion-ordered dictionaries.
yaml
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Depth¶
Limits YAML node nesting depth.
yaml
Type: System.Int32
DefaultValue: 100
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Encoding¶
Selects the fallback decoder when a file has no byte order mark.
yaml
Type: System.String
DefaultValue: utf8
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-LiteralPath¶
Resolves exact paths from LiteralPath, PSPath, or FullName properties.
yaml
Type: System.String[]
DefaultValue: ''
SupportsWildcards: false
Aliases:
- PSPath
- FullName
ParameterSets:
- Name: LiteralPath
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxAliases¶
Limits alias nodes in each file.
yaml
Type: System.Int32
DefaultValue: 1000
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxNodes¶
Limits the number of YAML nodes in each file.
yaml
Type: System.Int32
DefaultValue: 100000
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxNumericLength¶
Limits digits in numeric scalars.
yaml
Type: System.Int32
DefaultValue: 4096
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxScalarLength¶
Limits decoded characters in one scalar.
yaml
Type: System.Int32
DefaultValue: 1048576
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxTagLength¶
Limits expanded characters in one tag.
yaml
Type: System.Int32
DefaultValue: 1024
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxTotalTagLength¶
Limits cumulative expanded tag characters.
yaml
Type: System.Int32
DefaultValue: 65536
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-NoEnumerate¶
Preserves each root YAML sequence as one output record.
yaml
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Path¶
Expands wildcard paths and accepts string pipeline values.
yaml
Type: System.String[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Path
Position: 0
IsRequired: true
ValueFromPipeline: true
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS¶
System.String¶
{{ Fill in the Description }}
System.IO.FileInfo¶
{{ Fill in the Description }}
System.String[]¶
{{ Fill in the Description }}
OUTPUTS¶
System.Object¶
The PowerShell value constructed from each imported YAML document.
{{ Fill in the Description }}
System.Object¶
{{ Fill in the Description }}
NOTES¶
Only FileSystem provider paths are supported.