jastbytes / pliksharp Goto Github PK
View Code? Open in Web Editor NEWA .NET API client for Plik, the scalable & friendly temporary file upload system, written in C#
License: MIT License
A .NET API client for Plik, the scalable & friendly temporary file upload system, written in C#
License: MIT License
Sample code:
private static string Upload(string plikEndpoint, int ttlInSeconds, string filePath)
{
var plikApi = RestService.For<IPlikApi>(plikEndpoint);
var uploadRequest = new UploadRequest()
{
OneShot = false,
Removable = true,
Ttl = ttlInSeconds
};
var uploadMetadata = plikApi.CreateUploadAsync(uploadRequest).Result;
using (var file = File.OpenRead(filePath))
{
var streamPart = new StreamPart(file, Path.GetFileName(filePath));
var uploadFile = plikApi.UploadFileAsync(uploadMetadata.Id, uploadMetadata.UploadToken, streamPart).Result;
return uploadFile.DownloadUrl(uploadMetadata.Id);
}
}
The following exception is thrown:
Unhandled exception. System.AggregateException: One or more errors occurred. (JSON integer 2817915216 is too large or small for an Int32. Path 'fileSize', line 1, position 236.)
---> Newtonsoft.Json.JsonReaderException: JSON integer 2817915216 is too large or small for an Int32. Path 'fileSize', line 1, position 236.
at Newtonsoft.Json.JsonTextReader.ParseReadNumber(ReadType readType, Char firstChar, Int32 initialPosition)
at Newtonsoft.Json.JsonTextReader.ParseNumber(ReadType readType)
at Newtonsoft.Json.JsonTextReader.ReadNumberValue(ReadType readType)
at Newtonsoft.Json.JsonTextReader.ReadAsInt32()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Refit.RequestBuilderImplementation.<>c__DisplayClass11_0`1.<b__0>d.MoveNext() in C:\projects\refit\Refit\RequestBuilderImplementation.cs:line 275
--- End of inner exception stack trace ---
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.