Git Product home page Git Product logo

Comments (2)

ranouf avatar ranouf commented on May 24, 2024

I m interested to know too.

In my case, I want to save the new generated file on Azure. Stream is what I m looking for.

from mediatoolkit.

buraktamturk avatar buraktamturk commented on May 24, 2024

@ranouf I was planning to use it in a that way, too.

I really wonder that why .net developers give Streams such a low interest. There is no Stream multiplexer proxy class in general, Amazon S3 file upload gets the size from Stream - no manual specifying size method, .NET restricts Stream classes specify size if seeking is not supported etc.

Doing these kind of things would be pretty cool. Without using Files, MemoryStreams, buffering, duplicating etc. We are living at 2018 and still wasting resources for a simple things.

The code bellow, would change the world, if the .NET developers believe in a such a thing.

//using(var source = new MultiplexerStream(Request.Body))
//using(var source1 = source.copyRead())
//using(var source2 = source.copyRead())
using(var stream1 = new MultiplexerStream())
using(var stream2 = stream1.copyRead())
using(var stream3 = stream1.copyRead())
 {
    using(var engine = new Engine()) {
       var thumbnailTask = engine.GetThumbnail(Request.Body, stream1, ...);
      // var thumbnailTask = engine.GetThumbnail(source1, stream1, ...);
      // var encode720pTask = engine.Encode...(source2, stream4, ...);

       var azureUploadTask = blob.UploadStream(stream2, ...);
       var amazonUploadTask = s3Client.PutObject(stream3, ...);

    // upload 720p version (stream4) to Azure and Amazon as well

       await Task.WhenAll(thumbnailTask, /* encode720pTask */, azureUploadTask, amazonUploadTask);

    }
}

from mediatoolkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.