Skip to content

Commit e5d65d5

Browse files
committed
Release 0.5.0. Implemented MfsApi.ReadFileStreamAsync.
1 parent b60a56b commit e5d65d5

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/CoreApi/MfsApi.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,21 @@ public async Task<string> ReadFileAsync(string path, long? offset = null, long?
108108
}
109109
}
110110

111+
/// <inheritdoc />
112+
public async Task<Stream> ReadFileStreamAsync(string path, long? offset = null, long? count = null, CancellationToken cancel = default)
113+
{
114+
if (count == 0)
115+
count = int.MaxValue; // go-ipfs only accepts int lengths
116+
117+
List<string> args = new List<string>();
118+
if (offset != null)
119+
args.Add($"offset={offset.Value}");
120+
if (offset != null)
121+
args.Add($"count={count.Value}");
122+
123+
return await ipfs.PostDownloadAsync("files/read", cancel, path, args?.ToArray());
124+
}
125+
111126
/// <inheritdoc />
112127
public async Task RemoveAsync(string path, bool? recursive = null, bool? force = null, CancellationToken cancel = default)
113128
{

src/IpfsHttpClient.csproj

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1010

1111
<!-- https://semver.org/spec/v2.0.0.html -->
12-
<Version>0.4.0</Version>
12+
<Version>0.5.0</Version>
1313
<AssemblyVersion>$(Version)</AssemblyVersion>
1414
<LangVersion>12.0</LangVersion>
1515

@@ -41,6 +41,13 @@
4141
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
4242
<AllowedOutputExtensionsInPackageBuildOutputFolder>.pdb;$(AllowedOutputExtensionsInPackageBuildOutputFolder)</AllowedOutputExtensionsInPackageBuildOutputFolder>
4343
<PackageReleaseNotes>
44+
--- 0.5.0 ---
45+
[Breaking]
46+
Inherited breaking changes from IpfsShipyard.Ipfs.Core 0.6.0. See release notes for details.
47+
48+
[New]
49+
Implemented MfsApi.ReadFileStreamAsync.
50+
4451
--- 0.4.0 ---
4552
[Breaking]
4653
No breaking changes for code in this library.
@@ -70,7 +77,7 @@ Added missing IFileSystemApi.ListAsync. Doesn't fully replace the removed IFileS
7077
</ItemGroup>
7178

7279
<ItemGroup>
73-
<PackageReference Include="IpfsShipyard.Ipfs.Core" Version="0.5.0" />
80+
<PackageReference Include="IpfsShipyard.Ipfs.Core" Version="0.6.0" />
7481
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
7582
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
7683
<PackageReference Include="Multiformats.Base" Version="2.0.2" />

0 commit comments

Comments
 (0)