Skip to content

Instantly share code, notes, and snippets.

@gooderist
Created September 16, 2017 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gooderist/9d9fe136984e88be7e6862e21ba61749 to your computer and use it in GitHub Desktop.
Save gooderist/9d9fe136984e88be7e6862e21ba61749 to your computer and use it in GitHub Desktop.
Convert a bunch of ppts to txt files
const fs = require('fs')
const ppt = require('ppt')
const path = require('path')
let inDir = 'raw-ppts'
let outDir = 'out'
fs.readdirSync(inDir).forEach(n=>{
if(n.endsWith('.ppt')) {
let inFile = path.join(inDir, n)
let outFile = path.join(outDir,
n.replace(/\s*\(\w*\).*beta/g, '')
.replace(/_*beta/g, '')
.replace('.ppt', '.txt')
.replace(/\s+/g, '-')
.toLowerCase()
);
fs.writeFileSync(outFile, ppt.utils.to_text(ppt.readFile(inFile)).join('\n'))
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment