function parseSTL(model, buffer) {
            if (isBinary(buffer)) {
              parseBinarySTL(model, buffer);
            } else {
              var reader = new DataView(buffer);

              if (!('TextDecoder' in window)) {
                console.warn(
                  'Sorry, ASCII STL loading only works in browsers that support TextDecoder (https://caniuse.com/#feat=textencoder)'
                );

                return model;
              }

              var decoder = new TextDecoder('utf-8');
              var lines = decoder.decode(reader);
              var lineArray = lines.split('\n');
              parseASCIISTL(model, lineArray);
            }
            return model;
          }
This function checks if the file is in ASCII format or in Binary format

It is done by searching keyword `solid` at the start of the file.

An ASCII STL data must begin with `solid` as the first six bytes.
However, ASCII STLs lacking the SPACE after the `d` are known to be
plentiful. So, check the first 5 bytes for `solid`.

Several encodings, such as UTF-8, precede the text with up to 5 bytes:
https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding
Search for `solid` to start anywhere after those prefixes.