Giter Site home page Giter Site logo
file2html photo

file2html Goto Github PK

repos: 14.0 gists: 0.0

Name: file2html

Type: Organization

Bio: file2html (JS convertor of files to HTML and CSS code), tools and file engines for it

file2html

Build Statusnpm npm npm Coverage Status

JS convertor of files to HTML and CSS code

Requirements

Supported formats

Usage

Installation

> npm i file2html

Installation of required engines for each file type:

> npm i file2html-text file2html-ooxml file2html-image 

Check supported formats to decide which engines you need.

Configuration

import * as file2html from 'file2html';
import TextReader from 'file2html-text';
import OOXMLReader from 'file2html-ooxml';
import ImageReader from 'file2html-image';

file2html.config({
    readers: [
        TextReader,
        OOXMLReader,
        ImageReader
    ]
});

File reading

file2html.read({
    fileBuffer, // ArrayBuffer
    meta // file2html.FileMetaInformation
}).then((file) => {
    // file is an instance of file2html.File type 
    const {styles, content} = file.getData();    
    
    // "render" a file content with styles
    document.body.innerHTML = styles + content;
});

FileMetaInformation

    {
        fileType: number; // optional
        mimeType: string; // optional
        name: string; // optional
        size: number; // optional
        creator: string; // optional
        createdAt: string; // optional
        modifiedAt: string; // optional
    }

File

    {
        getMeta () {
            // returns object of file2html.FileMetaInformation    
        }
    
        getData ()  {
            // returns object of file2html.FileData
        }
    }

FileData

    {
        meta: file2html.FileMetaInformation;
        styles: string; // css styles as a string
        content: string; // html markup as a string
    }

Showcase

StormFiles

Browser extension, file viewer:

file2html's Projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.