LaserWeb / deprecated-LaserWeb3

Open Source Laser Cutter / Engraver software. Supports gcode, svg, dxf, stl, png, jpg, bmp
265 stars 68 forks source link

Enhancement: Upload to USB via nodejs #171

Closed ghost closed 7 years ago

ghost commented 7 years ago

Stumbled across this cool module https://github.com/resin-io-modules/drivelist

It lists the connected drives in your computer. The resulting drives contain a system property that determines if the drive is removable or not, for example, on Windows:

    {
        device: '\\\\.\\PHYSICALDRIVE0',
        description: 'WDC WD10JPVX-75JC3T0',
        size: '1000 GB'
        mountpoint: 'C:',
        system: true
    },
    {
        device: '\\\\.\\PHYSICALDRIVE1',
        description: 'Generic STORAGE DEVICE USB Device',
        size: '15 GB'
        mountpoint: 'D:',
        system: false
    }
]

You can filter the list by the one you're interested in, and inspect the system property:

var drivelist = require('drivelist');

drivelist.list(function(error, disks) {
  if (error) throw error;

  var drive = drives.find(function(drive) {
    return drive.mountpoint === 'C:';
  });

  if (drive.system) {
    console.log('C: is not removable!');
  }
});

They use various mechanisms to determine if a drive is removable, feel free to take a closer look on the platform you that you're most interested in!

ghost commented 7 years ago

Awesome! This will definitely provide users with much more reliable and consistent results than streaming over USB or WIFI.

ghost commented 7 years ago

Alright, I did some experimentation with this on github.com/openhardwarecoza/CoPrint

USB Drive view usb view

Upload to SD sd upload

Evn "View Config" view config

Busy adding Play + firmware update too

ghost commented 7 years ago

So, sadly, after +Wolfmanjm's comments in thread here https://plus.google.com/+PetervanderWalt/posts/BMkq52ME4DW?sfc=true I'll close this one as WONT IMPLEMENT