Giter VIP home page Giter VIP logo

Comments (5)

mscdex avatar mscdex commented on July 17, 2024

I think I'd prefer to leave that to userland to implement something like that. From my experience, convenience features like these typically end up being highly opinionated and I try to keep the module's focus on getting the core/less opinionated things right.

from ssh2-streams.

virtuald avatar virtuald commented on July 17, 2024

Ok. thanks.

from ssh2-streams.

virtuald avatar virtuald commented on July 17, 2024

@mscdex I looked a bit harder at this and my preference is to modify the behavior of fastPut that way I only need to implement the rename in one place (as putDirectory, etc all use it underneath the hood). Unfortunately, I didn't find a good mechanism to intercept the behavior, so I did it this way via a monkey patch: https://github.com/garygrossgarten/github-action-scp/blob/09a05dd06e8768d1327f701ef081f6f063834c3b/src/index.ts#L25

Generally speaking it seems that monkey patching is discouraged in Javascript, but there doesn't seem to be a hooking mechanism to insert the rename in there. Did I miss something? Would you be willing to insert a hook for this sort of thing, or do you think the monkey patching is fine.

Thanks! We've found this library (indirectly) to be really useful for automating our builds, I'm glad it exists. :)

from ssh2-streams.

mscdex avatar mscdex commented on July 17, 2024

There is no hooking mechanism. A better alternative would be to just make it a new function (not on the prototype of course) instead of overwriting the existing fastPut() and have your application use that instead 🤷‍♂️

from ssh2-streams.

virtuald avatar virtuald commented on July 17, 2024

Well, but then I'd have to copy and change the massive bit of code that involved putting a directory, in addition to the file putting code....

Oh, I see! 🤦 I had thought putDirectory was in this library, but it's in node-ssh. I'll make a different issue there.

from ssh2-streams.

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.