Socket
Socket
Sign inDemoInstall

escpos-buffer

Package Overview
Dependencies
3
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0 to 4.0.1

dist/connection/WebBluetooth.d.ts

1

dist/connection/index.d.ts
/// <reference types="node" />
export { default as InMemory } from './InMemory';
export { default as WebUSB } from './WebUSB';
export { default as WebBluetooth } from './WebBluetooth';
export interface Connection {

@@ -5,0 +6,0 @@ open(): Promise<void>;

4

dist/connection/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebUSB = exports.InMemory = void 0;
exports.WebBluetooth = exports.WebUSB = exports.InMemory = void 0;
var InMemory_1 = require("./InMemory");

@@ -8,2 +8,4 @@ Object.defineProperty(exports, "InMemory", { enumerable: true, get: function () { return InMemory_1.default; } });

Object.defineProperty(exports, "WebUSB", { enumerable: true, get: function () { return WebUSB_1.default; } });
var WebBluetooth_1 = require("./WebBluetooth");
Object.defineProperty(exports, "WebBluetooth", { enumerable: true, get: function () { return WebBluetooth_1.default; } });
//# sourceMappingURL=index.js.map
import { Filter } from '.';
import { PNG } from 'pngjs';
import { ImageData } from '../Image';
export default class BayerOrdered implements Filter {
process(image: PNG): PNG;
process(image: ImageData): ImageData;
}

@@ -30,4 +30,3 @@ "use strict";

}
image.data = new_data;
return image;
return { width, height, data: new_data };
}

@@ -34,0 +33,0 @@ }

import { Filter } from '.';
import { PNG } from 'pngjs';
import { ImageData } from '../Image';
export default class FloydSteinberg implements Filter {
process(image: PNG): PNG;
process(image: ImageData): ImageData;
}

@@ -48,4 +48,3 @@ "use strict";

}
image.data = new_data;
return image;
return { width, height, data: new_data };
}

@@ -52,0 +51,0 @@ }

@@ -0,7 +1,7 @@

import { ImageData } from '../Image';
export { default as Threshold } from './Threshold';
export { default as BayerOrdered } from './BayerOrdered';
export { default as FloydSteinberg } from './FloydSteinberg';
import { PNG } from 'pngjs';
export interface Filter {
process(image: PNG): PNG;
process(imageData: ImageData): ImageData;
}
import { Filter } from '.';
import { PNG } from 'pngjs';
import { ImageData } from '../Image';
export default class Threshold implements Filter {
process(image: PNG): PNG;
process(image: ImageData): ImageData;
}

@@ -22,4 +22,3 @@ "use strict";

}
image.data = new_data;
return image;
return { width, height, data: new_data };
}

@@ -26,0 +25,0 @@ }

/// <reference types="node" />
import { Filter } from './filter';
import { PNG } from 'pngjs';
export interface ImageData {
readonly data: Buffer;
readonly height: number;
readonly width: number;
}
export default class Image {

@@ -9,7 +13,5 @@ data: Buffer;

bytesPerRow: number;
constructor(input?: string | Buffer | PNG, filter?: Filter);
loadImage(filename: string, filter: Filter): void;
loadImageData(data: Buffer, filter: Filter): void;
constructor(imageData: ImageData, filter?: Filter);
private readImage;
lineData(index: number): Buffer;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const filter_1 = require("./filter");
const fs = require("fs");
const pngjs_1 = require("pngjs");
class Image {
constructor(input = null, filter = new filter_1.FloydSteinberg()) {
if (input instanceof pngjs_1.PNG) {
this.readImage(filter.process(input));
}
else if (typeof input === 'string') {
this.loadImage(input, filter);
}
else if (input) {
this.loadImageData(input, filter);
}
constructor(imageData, filter = new filter_1.FloydSteinberg()) {
this.readImage(filter.process(imageData));
}
loadImage(filename, filter) {
const data = fs.readFileSync(filename);
this.loadImageData(data, filter);
}
loadImageData(data, filter) {
const png = pngjs_1.PNG.sync.read(data);
const image = filter.process(png);
this.readImage(image);
}
readImage(image) {

@@ -28,0 +9,0 @@ const width = image.width;

@@ -5,5 +5,6 @@ export * from './actions';

export { default as Image } from './graphics/Image';
export * from './graphics/Image';
export { default as Manager } from './graphics/Manager';
export * from './graphics/filter';
export * from './Printer';
export { default as Printer } from './Printer';
export { PNG } from 'pngjs';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PNG = exports.Printer = exports.Image = exports.Model = void 0;
exports.Printer = exports.Manager = exports.Image = exports.Model = void 0;
const tslib_1 = require("tslib");

@@ -11,2 +11,5 @@ tslib_1.__exportStar(require("./actions"), exports);

Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return Image_1.default; } });
tslib_1.__exportStar(require("./graphics/Image"), exports);
var Manager_1 = require("./graphics/Manager");
Object.defineProperty(exports, "Manager", { enumerable: true, get: function () { return Manager_1.default; } });
tslib_1.__exportStar(require("./graphics/filter"), exports);

@@ -16,4 +19,2 @@ tslib_1.__exportStar(require("./Printer"), exports);

Object.defineProperty(exports, "Printer", { enumerable: true, get: function () { return Printer_1.default; } });
var pngjs_1 = require("pngjs");
Object.defineProperty(exports, "PNG", { enumerable: true, get: function () { return pngjs_1.PNG; } });
//# sourceMappingURL=index.js.map
import Model from './Model';
import { Connection } from './connection';
import Image from './graphics/Image';
import { StyleConf } from './profile';
import { Cut, Drawer, Align } from './actions';
import { SupportedModel } from './capabilities';
import Image from './graphics/Image';
import Manager from './graphics/Manager';
export default class Printer {

@@ -24,3 +25,3 @@ private model;

close(): Promise<void>;
static CONNECT(_model: SupportedModel | Model, connection: Connection): Promise<Printer>;
static CONNECT(_model: SupportedModel | Model, connection: Connection, imageManager?: Manager): Promise<Printer>;
}

@@ -78,3 +78,3 @@ "use strict";

}
static CONNECT(_model, connection) {
static CONNECT(_model, connection, imageManager) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {

@@ -90,2 +90,3 @@ let model;

model.profile.connection = connection;
model.profile.imageManager = imageManager;
yield model.profile.initialize();

@@ -92,0 +93,0 @@ return new Printer(model);

@@ -5,2 +5,3 @@ import { Connection } from '../connection';

import Image from '../graphics/Image';
import Manager from '../graphics/Manager';
export type StyleConf = {

@@ -20,2 +21,3 @@ width?: number;

protected capabilities: Capability;
imageManager?: Manager;
constructor(capabilities: Capability);

@@ -22,0 +24,0 @@ abstract feed(lines: number): Promise<void>;

@@ -7,3 +7,2 @@ "use strict";

const iconv = require("iconv-lite");
const QRCode = require("qrcode");
const Image_1 = require("../graphics/Image");

@@ -94,4 +93,7 @@ const filter_1 = require("../graphics/filter");

return tslib_1.__awaiter(this, void 0, void 0, function* () {
const buffer = yield QRCode.toBuffer(data, { scale: size });
const image = new Image_1.default(buffer, new filter_1.Threshold());
if (!this.imageManager) {
throw new Error('No image manager to draw qrcode');
}
const imageData = yield this.imageManager.buildQrcodeImage(data, size);
const image = new Image_1.default(imageData, new filter_1.Threshold());
return this.draw(image);

@@ -98,0 +100,0 @@ });

{
"name": "escpos-buffer",
"version": "4.0.0",
"version": "4.0.1",
"description": "Library to generate buffer for thermal printers.",

@@ -5,0 +5,0 @@ "author": "GrandChef Team <desenvolvimento@grandchef.com.br>",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc