Comments (9)
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.
Releasing a new version that will have no mkdirp installed, will use node directly, this week.
FYI
from node-portfinder.
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.
I'm hoping for a breaking change... v14 is the LTS right now...
from node-portfinder.
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.
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.
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.
@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.
see #137 for current status, fyi
from node-portfinder.
Related Issues (20)
- 【feature request】support to use array as basePort HOT 3
- Should portfinder also have a getPortsPromise function? HOT 2
- Free port still in use HOT 3
- All ports lower than 1024 are closed HOT 2
- Version mismatch on `mkdirp` between `package.json` and `package-lock.json` HOT 1
- Update ci to test new versions of npm HOT 3
- If callback is passed to getPort() then all errors should be returned as first parameter of callback HOT 1
- migrate to mkdirp v1 HOT 9
- Webpack doesn't like portfinder HOT 14
- Cluster apps are all on same port instead of different ports HOT 2
- no highestPort ts definition in latest version HOT 2
- Update Readme to Specify NOT to use outside development port finding HOT 1
- Consider Dropping Legacy Support for Node JS 0.10.x HOT 6
- Please update mkdirp from 0.5.5 to 0.5.6 HOT 2
- Update "async" dependency HOT 9
- version 1.0.29 doesn't compile with typescript HOT 4
- `testPort` gets called with `65536`
- Create code of conduct HOT 1
- Before filing a socket not closed issue: understanding async I/O + ordering + OS differences + stability requirements HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-portfinder.