Table of Contents

Interface IAsyncPackageCoreReader

Namespace
NuGet.Packaging.Core
Assembly
Chocolatey.NuGet.Packaging.dll

A basic asynchronous package reader that provides the identity, min client version, and file access.

public interface IAsyncPackageCoreReader : IDisposable
Inherited Members
Extension Methods

Remarks

Higher level concepts used for normal development nupkgs should go at a higher level

Methods

CopyFilesAsync(string, IEnumerable<string>, ExtractPackageFileDelegate, ILogger, CancellationToken)

Asynchronously copies files from a package to a new location.

Task<IEnumerable<string>> CopyFilesAsync(string destination, IEnumerable<string> packageFiles, ExtractPackageFileDelegate extractFile, ILogger logger, CancellationToken cancellationToken)

Parameters

destination string

The destination path to copy to.

packageFiles IEnumerable<string>

The package files to copy.

extractFile ExtractPackageFileDelegate

A package file extraction delegate.

logger ILogger

A logger.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IEnumerable<string>>

A task that represents the asynchronous operation. The task result (Result) returns am IEnumerable<T> for the copied file paths.

Exceptions

OperationCanceledException

Thrown if cancellationToken is cancelled.

GetFilesAsync(string, CancellationToken)

Asynchronously gets files in a folder in the package.

Task<IEnumerable<string>> GetFilesAsync(string folder, CancellationToken cancellationToken)

Parameters

folder string

A folder path in the package.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IEnumerable<string>>

A task that represents the asynchronous operation. The task result (Result) returns an IEnumerable<T> for files under the specified folder.

Exceptions

OperationCanceledException

Thrown if cancellationToken is cancelled.

GetFilesAsync(CancellationToken)

Asynchronously gets all files in the package.

Task<IEnumerable<string>> GetFilesAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IEnumerable<string>>

A task that represents the asynchronous operation. The task result (Result) returns an IEnumerable<T>.

Exceptions

OperationCanceledException

Thrown if cancellationToken is cancelled.

GetIdentityAsync(CancellationToken)

Asynchronously gets the identity of the package.

Task<PackageIdentity> GetIdentityAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<PackageIdentity>

A task that represents the asynchronous operation. The task result (Result) returns a PackageIdentity.

Exceptions

OperationCanceledException

Thrown if cancellationToken is cancelled.

GetMinClientVersionAsync(CancellationToken)

Asynchronously gets the minimum client version needed to consume the package.

Task<NuGetVersion> GetMinClientVersionAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<NuGetVersion>

A task that represents the asynchronous operation. The task result (Result) returns a NuGet.Versioning.NuGetVersion.

Exceptions

OperationCanceledException

Thrown if cancellationToken is cancelled.

GetNuspecAsync(CancellationToken)

Asynchronously gets a nuspec stream.

Task<Stream> GetNuspecAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<Stream>

A task that represents the asynchronous operation. The task result (Result) returns a Stream.

Exceptions

OperationCanceledException

Thrown if cancellationToken is cancelled.

GetNuspecFileAsync(CancellationToken)

Asynchronously gets a nuspec file path.

Task<string> GetNuspecFileAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<string>

A task that represents the asynchronous operation. The task result (Result) returns a string representing the nuspec file path.

Exceptions

OperationCanceledException

Thrown if cancellationToken is cancelled.

GetPackageTypesAsync(CancellationToken)

Asynchronously gets zero or more package types from the .nuspec.

Task<IReadOnlyList<PackageType>> GetPackageTypesAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A cancellation token.

Returns

Task<IReadOnlyList<PackageType>>

A task that represents the asynchronous operation. The task result (Result) returns an IReadOnlyList<T>.

Exceptions

OperationCanceledException

Thrown if cancellationToken is cancelled.

GetStreamAsync(string, CancellationToken)

Asynchronously returns a file stream from the package.

Task<Stream> GetStreamAsync(string path, CancellationToken cancellationToken)

Parameters

path string

The file path in the package.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<Stream>

A task that represents the asynchronous operation. The task result (Result) returns a Stream.

Exceptions

OperationCanceledException

Thrown if cancellationToken is cancelled.