Skip to content

Instantly share code, notes, and snippets.

@matteofigus
Created March 31, 2017 11:11
Show Gist options
  • Save matteofigus/1b9aa210ef3b67ae1be263a0deb426f2 to your computer and use it in GitHub Desktop.
Save matteofigus/1b9aa210ef3b67ae1be263a0deb426f2 to your computer and use it in GitHub Desktop.
Replace nbsp to regular whitespace in a folder of files
const _ = require('lodash')
const fs = require('fs')
const location = './en-us'
const files = fs.readdirSync(location)
_.each(files, (file) => {
const filePath = `${location}/${file}`
const content = fs.readFileSync(filePath, 'utf-8')
fs.writeFileSync(filePath, content.replace(/ /g, ' '))
})
console.log('done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment