function indentString(str, n) {
    return str.split("\n").map(x => " ".repeat(n) + x).join("\n")
}

const data = `foo
bar
baz
  qux
buzz
`

console.log(indentString(data, 4))

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: