56324ae45c | ||
---|---|---|
eng | ||
src | ||
.editorconfig | ||
.gitignore | ||
AzCopy.Net.sln | ||
CODE_OF_CONDUCT.md | ||
CodeCoverage.runsettings | ||
Directory.Build.props | ||
Directory.Build.targets | ||
LICENSE | ||
NuGet.config | ||
README.md | ||
SECURITY.md | ||
ci.yaml | ||
global.json | ||
stylecop.json |
README.md
AzCopy.Net
AzCopy.Net is a .net standard library for AzCopy. It is a thin wrapper out of AzCopy v10 cli.
Quick start
First, add nuget reference to AzCopy.Client
. It provides straight forward API to call into AzCopy v10 cli.
<PackageReference Include="AzCopy.Client" Version="1.0.0" />
Then add reference to one of the four nuget asset packages based on your OS and platform. The version of these packages are corresponded to the version of azcopy v10 cli it carries with.
- AzCopy.WinX64
- AzCopy.WinX86
- AzCopy.OsxX64
- AzCopy.LinuxX64
For example:
<PackageReference Include="AzCopy.WinX64" Version="1.0.0" />
If azcopy v10 cli has already installed on your machine, you can also add its full path to $AZCOPYPATH
. When running the app, AzCopy.Client
will use the azcopy cli pointed by $AZCOPYPATH
.
Finally, use AzCopy.Client the same way of using azcopy in cmd!
var localFile = new LocalLocation()
{
UseWildCard = true,
Path = @"src",
};
var sasLocation = new RemoteSasLocation()
{
ResourceUri = @"uri",
Container = @"container"
Path = @"dest",
SasToken = @"sastoken",
};
var option = new AZCopyOption()
{
IncludePattern = "*.jpg;*.png",
};
var client = new AZCopyClient();
// subscribe output event hander to get output from azcopy v10 cli
client.OutputMsgHandler += (object sender, JsonOutputTemplate e) =>
{
Console.WriteLine(e.MessageContent);
};
await client.CopyAsync(localFile, sasLocation, option);
Supported command
AzCopy.Net
supports all commands that azcopy v10 cli has. The interface of supported command is AzCopy.Contract.IAZCopyClient
, and is implemented by AzCopy.Client.AzCopyClient
class.
The supported command list is presented below.
bench
copy
doc
env
jobs clean
jobs list
jobs remove
jobs resume
jobs show
list
login
logout
make
remove
sync
Tested senarios
The following scenarios have been validated on windows, mac os and ubuntu.
- Upload files and directories to azure blob container (use SAS only)
- Delete files and directories from azure blob container (use SAS only)
- Download files and directories from azure blob container (use SAS only)
Nightly build
https://pkgs.dev.azure.com/xiaoyuz0315/BigMiao/_packaging/AzCopy.Net/nuget/v3/index.json
Pre-released package
AzCopy.Net | Local |
---|---|
AzCopy.Contract | |
AzCopy.Client | |
AzCopy.WinX64 | |
AzCopy.WinX86 | |
AzCopy.OsxX64 | |
AzCopy.LinuxX64 |
Examples
Check AzCopy.Test for more examples.