@sevenqi/nodechannel
Version:
nodejs channel
45 lines • 1.7 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.HidStream = void 0;
var stream_1 = require("stream");
var node_hid_1 = require("node-hid");
var HidStream = /** @class */ (function (_super) {
__extends(HidStream, _super);
function HidStream(path) {
var _this = _super.call(this) || this;
_this.path = path;
return _this;
}
HidStream.prototype._write = function (chunk, encoding, callback) {
this.hid.write(chunk);
callback();
};
HidStream.prototype._read = function (size) {
this.resume();
};
HidStream.prototype.open = function () {
var _this = this;
this.hid = new node_hid_1.HID(this.path);
this.hid.on("data", function (data) {
_this.push(data);
});
};
return HidStream;
}(stream_1.Duplex));
exports.HidStream = HidStream;
//# sourceMappingURL=HidStream.js.map