code: function writeDataToFile (file, data, token) {
    // insertionPoint was set in hasInsertionPoint(), so we can assume it is safe to write to file
    var selectors = [
      'head > meta:last-of-type',
      'head > link:first-of-type',
      'head'
    ]
    var selectorIndex = 0
  
    switch (insertionPoint) {
      case 'meta':
        selectorIndex = 0
        break
      case 'link':
        selectorIndex = 1
        break
      case 'head':
        selectorIndex = 2
        break
      case 'token':
        let html = String(file.contents).replace(token, data)
        return new Buffer(html)
      default:
        return ''
    }
  
    var soup = new Soup(String(file.contents))
  
    // Inject Resource Hints
    soup.setInnerHTML(selectors[selectorIndex], function (oldHTML) {
      if (insertionPoint === 'link') {
        return data + oldHTML
      }
      return oldHTML + data
    })
  
    return soup.toString()
  }
docs: Write resource hints to file
  @param {stream} file
  @param {string} data
  @param {string} token
  @return {string}