How to use the write function from bindings

Find comprehensive JavaScript bindings.write code examples handpicked from public code repositorys.

78
79
80
81
82
83
84
85
86

  if (!Buffer.isBuffer(data)) {
    data = Buffer.from(<any[]>data);
  }

  const answer = await fromCallback(cb => wire.write(data, cb));
  await tick();
  return answer;
}
fork icon90
star icon0
watch icon2

+ 9 other calls in file

39
40
41
42
43
44
45
46
47
48
 * @param {Number} fd
 * @param {Buffer|String} buf
 */

export function write (fd, buf) {
  return bindings.write(fd, buf, buf.length);
}

/**
 * Print formatted text to `fd'
fork icon3
star icon25
watch icon10

+ 9 other calls in file

122
123
124
125
126
127
128
129
130
131

SerialPort.prototype.write = function (b) { 
  if (Buffer.isBuffer(b))
    serialport_native.write(this.fd, b);
  else
    serialport_native.write(this.fd, new Buffer(b));
};


SerialPort.prototype.end = function(buf, enc) {
fork icon0
star icon5
watch icon4

+ 19 other calls in file

31
32
33
34
35
36
37
38
39
40
_destroy() {
        bindings.close(this.inst);
}
_final() {}
_write(chunk: any, encoding: string, next: () => void) {
        bindings.write(this.inst, chunk);
        next();
}
isOpened() {
        return this.inst ? true : false;
fork icon1
star icon0
watch icon0

122
123
124
125
126
127
128
129
130
131

  if (!this.isOpen) {
    return asyncError(cb, new Error('Port is not open'));
  }

  binding.write(this.fd, buffer, cb);
};

const commonMethods = [
  'drain',
fork icon0
star icon0
watch icon1

+ 11 other calls in file

Other functions in bindings

Sorted by popularity

function icon

bindings.createKey is the most popular function in bindings (8616 examples)