Giter Club home page Giter Club logo

Comments (3)

bradenmacdonald avatar bradenmacdonald commented on August 17, 2024 1

Sorry for the slow reply. I think this is doable, along the lines that you sketched out. I'm just wondering if it's necessary? If you're doing any long-lived requests, you're probably using the streams API, and it already provides a way to inject a signal as well as cancel the request:

const downloadResult = await client.getObject(destKey);
const file = await Deno.open("outfile.dat", {write: true});
const controller = new AbortController();
downloadResult.body?.pipeTo(file.writable, {signal: controller.signal});

or downloadResult.body?.getReader().cancel(); will also cancel it.

Would one of those approaches cover your use case? Or is there a unique benefit to specifying a signal at the fetch level? (I haven't tried these myself, but I noticed they're there in the API.)

from s3-lite-client.

alexgleason avatar alexgleason commented on August 17, 2024

I didn't know that was possible. Thank you for the explanation and example! 👏

from s3-lite-client.

bradenmacdonald avatar bradenmacdonald commented on August 17, 2024

You're welcome! Though as I said, I haven't tried these myself. So feel free to re-open if you find something still missing.

from s3-lite-client.

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.