Skip to content

Instantly share code, notes, and snippets.

@elzii
Last active July 7, 2017 00:18
Show Gist options
  • Select an option

  • Save elzii/454600cd14c2cbbf8e1c96a8ef86d238 to your computer and use it in GitHub Desktop.

Select an option

Save elzii/454600cd14c2cbbf8e1c96a8ef86d238 to your computer and use it in GitHub Desktop.
Console script to convert SitePoint table of mimetypes to JSON string - https://www.sitepoint.com/mime-types-complete-list
var data = []
document.querySelectorAll('tbody tr').forEach(el => {
var td = el.querySelectorAll('td')
data.push({
'suffix': td[0].innerHTML.replace(/\./, ''),
'contentType': td[1].innerHTML
})
})
var json = JSON.stringify({
'mimeTypes': data
}, null, 2)
document.write(`<pre>${json}</pre>`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment