Thursday, September 26, 2024

course: CS50 Web

CS50's Web Programming with Python and JavaScript @Harvard.edu

This course picks up where CS50x leaves off, diving more deeply into the design and implementation of web apps with Python, JavaScript, and SQL using frameworks like Django, React, and Bootstrap. Topics include database design, scalability, security, and user experience. Through hands-on projects, students learn to write and use APIs, create interactive UIs, and leverage cloud services like GitHub and Heroku. By semester’s end, students emerge with knowledge and experience in principles, languages, and tools that empower them to design and deploy applications on the Internet.

Mammoth: JavaScript docx file reader lib

mammoth - npm

Mammoth is designed to convert .docx documents, such as those created by Microsoft Word, Google Docs and LibreOffice, and convert them to HTML. Mammoth aims to produce simple and clean HTML by using semantic information in the document, and ignoring other details. For instance, Mammoth converts any paragraph with the style Heading 1 to h1 elements, rather than attempting to exactly copy the styling (font, text size, colour, etc.) of the heading.

const mammoth = require("mammoth");

mammoth.extractRawText({ path: "example.docx" })
    .then(result => {
        console.log(result.value); // The raw text
    })
    .catch(err => {
        console.error(err);
    });
const fs = require('fs');
const mammoth = require('mammoth');

async function readDocxFile(filePath) {
        const arrayBuffer = await fs.promises.readFile(filePath);
        const result = await mammoth.convertToHtml({ arrayBuffer });
        console.log(result.value); // The HTML content
}

Other supported platforms

alternatives