@mmote/niimblue-node 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,27 +37,33 @@ const cliConnectAndPrintImageFile = async (path, options) => {
37
37
  if (options.debug) {
38
38
  console.log("Print task:", printTask);
39
39
  }
40
+ let status = 1;
40
41
  try {
41
42
  await (0, utils_1.printImage)(client, printTask, encoded, {
42
43
  quantity: options.quantity,
43
44
  labelType: options.labelType,
44
45
  density: options.density,
45
46
  });
47
+ status = 0;
46
48
  }
47
49
  finally {
48
50
  await client.disconnect();
49
51
  }
50
- process.exit(0);
52
+ process.exit(status);
51
53
  };
52
54
  exports.cliConnectAndPrintImageFile = cliConnectAndPrintImageFile;
53
55
  const cliScan = async (options) => {
54
56
  if (options.transport === "ble") {
55
57
  const devices = await __1.NiimbotHeadlessBleClient.scan(options.timeout);
56
- devices.forEach((dev) => console.log(`${dev.address}: ${dev.name}`));
58
+ for (const dev of devices) {
59
+ console.log(`${dev.address}: ${dev.name}`);
60
+ }
57
61
  }
58
62
  else if (options.transport === "serial") {
59
63
  const devices = await __1.NiimbotHeadlessSerialClient.scan();
60
- devices.forEach((dev) => console.log(`${dev.address}: ${dev.name}`));
64
+ for (const dev of devices) {
65
+ console.log(`${dev.address}: ${dev.name}`);
66
+ }
61
67
  }
62
68
  process.exit(0);
63
69
  };
package/dist/utils.js CHANGED
@@ -63,10 +63,9 @@ const printImage = async (client, printTaskName, encoded, options) => {
63
63
  await printTask.printPage(encoded, options.quantity ?? 1);
64
64
  await printTask.waitForFinished();
65
65
  }
66
- catch (e) {
67
- console.error(e);
66
+ finally {
67
+ await printTask.printEnd();
68
68
  }
69
- await printTask.printEnd();
70
69
  };
71
70
  exports.printImage = printImage;
72
71
  const loadImageFromBase64 = async (b64) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmote/niimblue-node",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "Headless clients for niimbluelib. Command line interface, simple REST server are also included.",
5
5
  "keywords": [
6
6
  "command-line",