node-thermal-printer-js 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/app.js +8 -8
  2. package/package.json +2 -4
package/app.js CHANGED
@@ -56,7 +56,7 @@ const runPythonProcess = ({ cmd, cmdArgs, scriptArgs }) =>
56
56
  });
57
57
  });
58
58
 
59
- const printViaComPort = async (order, options = {}) => {
59
+ const printViaComPort = async (data, options = {}) => {
60
60
  const portPath = options.portPath || process.env.PRINTER_COM_PORT || "COM5";
61
61
  const baudRate = options.baudRate || 9600;
62
62
 
@@ -84,7 +84,7 @@ const printViaComPort = async (order, options = {}) => {
84
84
  if (err)
85
85
  return reject(new Error(`Failed to open ${portPath}: ${err.message}`));
86
86
 
87
- const payload = getEscPosPayload(order);
87
+ const payload = getEscPosPayload(data);
88
88
 
89
89
  port.write(payload, (writeErr) => {
90
90
  if (writeErr) {
@@ -103,8 +103,8 @@ const printViaComPort = async (order, options = {}) => {
103
103
  });
104
104
  };
105
105
 
106
- const printViaBleBridge = (order, options = {}) => {
107
- const payload = getEscPosPayload(order).toString("base64");
106
+ const printViaBleBridge = (data, options = {}) => {
107
+ const payload = getEscPosPayload(data).toString("base64");
108
108
  const args = [
109
109
  bleScriptPath,
110
110
  "--data-b64",
@@ -185,13 +185,13 @@ const printViaBleBridge = (order, options = {}) => {
185
185
 
186
186
  // Print to a paired Bluetooth printer exposed as a Windows COM (RFCOMM) port.
187
187
  // Preferable on Windows: pair the PSF588 printer in OS Bluetooth settings
188
- // and note the outgoing COM port (e.g. COM5). Then call `printToPSF588(order, { portPath: 'COM5' })`.
189
- export const printData = (order, options = {}) => {
188
+ // and note the outgoing COM port (e.g. COM5). Then call `printToPSF588(data, { portPath: 'COM5' })`.
189
+ export const printData = (data, options = {}) => {
190
190
  const transport = options.transport || process.env.PRINTER_TRANSPORT || "ble";
191
191
 
192
192
  if (transport === "ble") {
193
- return printViaBleBridge(order, options);
193
+ return printViaBleBridge(data, options);
194
194
  }
195
195
 
196
- return printViaComPort(order, options);
196
+ return printViaComPort(data, options);
197
197
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-thermal-printer-js",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "ESC/POS printer helper for PSF588 Bluetooth and COM printing.",
5
5
  "main": "app.js",
6
6
  "exports": {
@@ -31,8 +31,6 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "escpos": "^3.0.0-alpha.6",
35
- "escpos-serialport": "^3.0.0-alpha.4",
36
34
  "serialport": "^13.0.0"
37
35
  }
38
- }
36
+ }