willfrew / node-random-org Goto Github PK
View Code? Open in Web Editor NEWTruly random numbers via Random.org's json-rpc api for Node.js
License: MIT License
Truly random numbers via Random.org's json-rpc api for Node.js
License: MIT License
All api calls should support an optional callback.
I'm not sure how/if this would affect performance since we wouldn't really be able to use Promise.method
as we wouldn't want to return a promise when someone is using the callback api and vice versa.
I'm getting an HTTP error while using the generateSignedStrings()
method. I'm using the free Developer API key. Keep in mind that this doesn't happen with a migrated Beta API key.
Console output:
{ Error: The API key you specified is not valid for the version of the API you are invoking at path\to\node_modules\random-org\src\RandomOrg.js:62:23 at process._tickCallback (internal/process/next_tick.js:68:7) code: 405 }
There's now a second release of the API that includes some additional api methods (see here for docs). We'll need to switch to the new endpoint by default and add support for those new methods.
#8 makes us compatible with the new api at least and for now it's possible to pass { endpoint: 'https://api.random.org/json-rpc/2/invoke' }
to the RandomOrg
constructor to switch to the new one but this isn't ideal.
Quickest way to add typescript support would be to add a definition file - converting to typescript is non-trivial given the current code structure.
The new api version added a few additional methods and parameters (docs here).
I am trying to import it in an React Application but it throws the error
Uncaught TypeError: url.parse is not a function RandomOrg.js:11
vite":·"^2.8.0
node: v16.13.2
react: 17.0.2
i am using method generateSignedIntegers
Sometimes, throw error, but in callback have only result. how i can catch error and to call method once again or to make other action?
There's no real need now with the most recent versions of node happily supporting Promises
natively.
Although for people who want to use the Promise-based api on older versions of node, we should let them pass a Promise
constructor as an optional parameter for us to use.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.