GithubHelp home page GithubHelp logo

michellekwa136 / collapsify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cloudflare/collapsify

0.0 1.0 0.0 400 KB

Collapsify inlines all the resources of a page into a single document

Home Page: https://github.com/cloudflare/collapsify

Makefile 3.21% JavaScript 96.79%

collapsify's Introduction

Collapsify Build Status

Inlines all of the JavaScripts, stylesheets, images, fonts etc. of an HTML page.

Installation

npm install -g collapsify

Usage

An HTTP server is installed as collapsify-server, which collapses the URL passed to “/?url=”. This HTTP server is systemd-aware: when running as a systemd service, collapsify will listen on the socket passed. Otherwise, this server defaults to listening on port 8020, which can be changed via the “-p” flag.

Additional options can by found via the built in usage information, collapsify-server -h.

API

var collapsify = require('collapsify');

collapsify('http://www.cloudflare.com', {
  headers: {
    Accept-Language: 'en-US'
  },
}).then(function(output) {
  console.log(output);
});

The “collapsify” function takes the URL to collapse, as well as an object of options, and returns a promise that resolves to a Buffer.

Options

  • headers: An object of headers, to be added to each HTTP request.
  • forbidden: A regex that matches blacklisted resources that should be avoided while navigating.

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.