code: function singleStringCoding(stream, string, on_finish, on_progress) {
    on_progress = on_progress || function() {};
    on_finish = on_finish || function() {};
  
    // possibly our input is an array of byte integers
    // or a typed array
    if (!Buffer.isBuffer(string))
      string = Buffer.from(string);
  
    var deferred = {}, failed = false;
  
    stream.once('error', function(err) {
      failed = true;
      on_finish(null, err);
    });
  
    // emulate Promise.defer()
    deferred.promise = new Promise(function(resolve, reject) {
      deferred.resolve = resolve;
      deferred.reject = reject;
    });
  
    // Since using the Promise API is optional, generating unhandled
    // rejections is not okay.
    deferred.promise.catch(noop);
  
    stream.once('error', function(e) {
      deferred.reject(e);
    });
  
    var buffers = [];
  
    stream.on('data', function(b) {
      buffers.push(b);
    });
  
    stream.once('end', function() {
      var result = Buffer.concat(buffers);
  
      if (!failed) {
        on_progress(1.0);
        on_finish(result);
      }
  
      if (deferred)
        deferred.resolve(result);
    });
  
    on_progress(0.0);
  
    stream.end(string);
  
    if (deferred)
      return deferred.promise;
  }
docs: /* compatibility: LZMA-JS (https://github.com/nmrugg/LZMA-JS)