Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
node-3dprinter-mks-wifi
Advanced tools
This package allows to manage a 3dPrinter with MKS WIFI support using node.
This package allows to manage a 3dPrinter with MKS WIFI support using node.
This package is designs for 3dPrinter using marlin derived firmware and supporting MKS WIFI featrues! This package requires NodeJS (version 16 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.
$ npm -v && node -v
BEFORE YOU INSTALL: please read the prerequisites
Clone this repo on your local machine:
$ git clone https://github.com/alealpha07/node-3dprinter-mks-wifi
$ cd node-3dprinter-mks-wifi
Install the npm package
$ npm install node-3dprinter-mks-wifi
To use the package you need to include the Printer
class in your index
file first
const Printer = require("node-3dprinter-mks-wifi"); // for npm
//const Printer = require("./printer"); // for github
create an instance of the Printer
by providing the correct IP
and PORT
const Printer = require("node-3dprinter-mks-wifi");
const IP = "192.168.1.1"; //replace with your IP
const PORT = "8080"; //replace with your PORT
const printer = new Printer(IP, PORT);
now you can use the functionalities of the printer by simply using the methods listed in the API
section
This simple example will connect, retrive the printing status and print it to the console.
const Printer = require("node-3dprinter-mks-wifi");
const IP = "192.168.1.1"; //replace with your IP
const PORT = "8080"; //replace with your PORT
const printer = new Printer(IP, PORT);
printer.connect().then(()=>{
printer.getState().then((result) => {
console.log(result);
}).catch((error) => {
console.log(error);
}).finally(()=>{
printer.disconnect();
})
})
With async/await:
const Printer = require("node-3dprinter-mks-wifi");
const IP = "192.168.1.1"; //replace with your IP
const PORT = "8080"; //replace with your PORT
const printer = new Printer(IP, PORT);
async function main(){
try{
await printer.connect();
let result = await printer.getState();
console.log(result);
}catch(error){
console.log(error);
}
finally{
printer.disconnect();
}
}
main();
constructor
new Printer(ip, port)
Supported options for the constructor
method are listed below.
ip
Type | Default value | Mandatory |
---|---|---|
string | null | yes |
port
Type | Default value | Mandatory |
---|---|---|
string | null | yes |
minimumExtruderTemperature
Type | Default value | Mandatory |
---|---|---|
number | 0 | no |
maximumExtruderTemperature
Type | Default value | Mandatory |
---|---|---|
number | 280 | no |
minimumBedTemperature
Type | Default value | Mandatory |
---|---|---|
number | 0 | no |
maximumBedTemperature
Type | Default value | Mandatory |
---|---|---|
number | 100 | no |
connect to the printer
printer.connect()
Supported options and possible results for the connect
method are listed below.
string
- Connected to printer at IP:PORT
if succeeded
string
- Connection error: ERROR
if failed
no option is present
disconnect from the printer
printer.disconnect()
Supported options and possible results for the disconnect
method are listed below.
string
- Disconnected from printer.
if succeeded
string
- Disconnection error: ERROR
if failed
no option is present
get status of the printer (printing, idle, pause)
printer.getState()
Supported options and possible results for the getState
method are listed below.
string
- STATUS STRING
if succeeded
string
- Error receiving data: ERROR
if failed
no option is present
get temperatures of the printer
printer.getTemperature()
Supported options and possible results for the getTemperature
method are listed below.
object
if succeeded:
{
nozzleCurrent: number,
nozzleTarget: number,
bedCurrent: number,
bedTarget: number,
extruder0Current: number,
extruder0Target: number,
extruder1Current: number,
extruder1Target: number,
heaterPower: number,
bedHeaterPower: number
}
string
- Error receiving data: ERROR
if failed
no option is present
get printing progress (percentage)
printer.getPrintingProgress()
Supported options and possible results for the getPrintingProgress
method are listed below.
number
- between 0
and 100
if succeeded:
string
- Error receiving data: ERROR
if failed
no option is present
get elapsed print time
printer.getPrintingTime()
Supported options and possible results for the getPrintingTime
method are listed below.
string
- hh:mm:ss
format if succeeded:
string
- Error receiving data: ERROR
if failed
no option is present
get currently in print file name
printer.getPrintingFilename()
Supported options and possible results for the getPrintingFilename
method are listed below.
string
- FILENAME.gcode
if succeeded:
string
- Error receiving data: ERROR
if failed
no option is present
get all files in 3d printer sd card
printer.getFilenames()
Supported options and possible results for the getFilenames
method are listed below.
list: [string]
- ['file1.gcode', 'file2.gcode', ...]
if succeeded:
string
- Error receiving data: ERROR
if failed
no option is present
start printing the selected file
printer.startPrinting(filename)
Supported options and possible results for the startPrinting
method are listed below.
string
- ok
if succeeded:
string
- Error receiving data: ERROR
if failed
filename
Type | Default value | Mandatory |
---|---|---|
string | null | yes |
bring the hotend to the home position
printer.home()
Supported options and possible results for the home
method are listed below.
string
- ok
if succeeded:
string
- Error receiving data: ERROR
if failed
no option is present
pause the print
printer.pause()
Supported options and possible results for the pause
method are listed below.
string
- ok
if succeeded:
string
- Error receiving data: ERROR
if failed
no option is present
resume the print
printer.resume()
Supported options and possible results for the resume
method are listed below.
string
- ok
if succeeded:
string
- Error receiving data: ERROR
if failed
no option is present
abort the print
printer.abort()
Supported options and possible results for the abort
method are listed below.
string
- ok
if succeeded:
string
- Error receiving data: ERROR
if failed
no option is present
start the fan
printer.startFan()
Supported options and possible results for the startFan
method are listed below.
string
- ok
if succeeded:
string
- Error receiving data: ERROR
if failed
speed
Type | Default value | Mandatory | Minimum | Maximum |
---|---|---|---|---|
number | 255 | no | 0 | 255 |
stop the fan
printer.stopFan()
Supported options and possible results for the stopFan
method are listed below.
string
- ok
if succeeded:
string
- Error receiving data: ERROR
if failed
set target extruder temperature
printer.setExtruderTemperature(temperature)
Supported options and possible results for the setExtruderTemperature
method are listed below.
string
- ok
if succeeded:
string
- Error receiving data: ERROR
if failed
temperature
Type | Default value | Mandatory | Minimum | Maximum |
---|---|---|---|---|
number | null | yes | 0 | 280 |
you can set custom minmum and maximum temperature in the constructor
extruder
Type | Default value | Mandatory | Minimum | Maximum |
---|---|---|---|---|
number | 0 | no | 0 | 1 |
you can set the extruder to use (0 for the first one, 1 for the second)
set target bed temperature
printer.setBedTemperature(temperature)
Supported options and possible results for the setBedTemperature
method are listed below.
string
- ok
if succeeded:
string
- Error receiving data: ERROR
if failed
temperature
Type | Default value | Mandatory | Minimum | Maximum |
---|---|---|---|---|
number | null | yes | 0 | 100 |
you can set custom minmum and maximum temperature in the constructor
FAQs
This package allows to manage a 3dPrinter with MKS WIFI support using node.
The npm package node-3dprinter-mks-wifi receives a total of 833 weekly downloads. As such, node-3dprinter-mks-wifi popularity was classified as not popular.
We found that node-3dprinter-mks-wifi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.