Nodejs using docker rest api’s

Is there any way in nodejs to call the github api that simulate the following:

docker login -u username -p password registry
I’ve the username password and the registry

I mean run a rest call that provide the registry username and password and get ok or error,

I found this reference but not sure if I can use a rest call to verify that user was connected succesfully

for example, I see in the docks something like

GET /v2/<name>/manifests/<reference>

but didnt find something with user and password

Source: Docker Questions