Giter Club home page Giter Club logo

Comments (9)

eriktrom avatar eriktrom commented on June 16, 2024

We could replace https://github.com/http-party/node-portfinder/blame/38cf0185a18c1ecb2c2590ae91f0a251b612ab15/lib/portfinder.js#L328 with the node builtin filesystem module.

That code is for creating sockets.

You'll recognize more pieces of that code here: https://github.com/http-party/node-portfinder/blame/38cf0185a18c1ecb2c2590ae91f0a251b612ab15/lib/portfinder.js#L384

Feel free to peruse the code, it's 11 years old and I didn't write it, not that that really matters at all. Here is the original commit: f1cd7ae

Submit a PR that uses the builtin node js mkdir: https://nodejs.org/api/fs.html#fsmkdirsyncpath-options and I'll merge it :)

from node-portfinder.

eriktrom avatar eriktrom commented on June 16, 2024

Releasing a new version that will have no mkdirp installed, will use node directly, this week.

FYI

from node-portfinder.

MasterOdin avatar MasterOdin commented on June 16, 2024

Are you looking to replace mkdirp with fs.mkdir and make use of the recursive flag added in v10 LTS (and thus breaking support for anything < 10), or doing the recursion by hand in fs.mkdir?

from node-portfinder.

jimmywarting avatar jimmywarting commented on June 16, 2024

I'm hoping for a breaking change... v14 is the LTS right now...

from node-portfinder.

eriktrom avatar eriktrom commented on June 16, 2024

mkdirp recursively created directories, so just to clarify @MasterOdin in your comment:

(and thus breaking support for anything < 10), or doing the recursion by hand in fs.mkdir?

we do want to recursively create a folder structure - at least that is how the original code was written, and hence its use of mkdirp, which 11 years ago, was how mkdir -p was popularly done in nodejs.

Let me know if I missed something here, thanks.

see #134 for its removal and use of native node api's for mkdir -p

Closed by #134

from node-portfinder.

MasterOdin avatar MasterOdin commented on June 16, 2024

I created #135 (as there was no test with the recursive folder creation) to help demonstrate my point where if you wish to support node < 10.12, then you'll need to either use mkdirp or do the recursion yourself as fs.mkdir does not support doing it in those old versions of node, but if you drop the old versions (which I'd argue you should), then fs.mkdir works fine as a replacement.

from node-portfinder.

eriktrom avatar eriktrom commented on June 16, 2024

closing in favor of use of native builtins from the nodejs' fs module: #134 #135 (collectively, #134 includes all changes for modernization, iteration 1, fwiw)

from node-portfinder.

eriktrom avatar eriktrom commented on June 16, 2024

@stefanocudini - to use this library, ideally wrap it in a cli, or you can also from your shell:

eval("require('./lib/portfinder').getPort({ host: '127.0.0.1', port: '8889'}, (err, port) => { console.log(port); })");

from node-portfinder.

eriktrom avatar eriktrom commented on June 16, 2024

see #137 for current status, fyi

from node-portfinder.

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.