GithubHelp home page GithubHelp logo

chitter99 / mime Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 17 KB

Small Javascript library for requesting mime string's of a remote resources.

License: GNU General Public License v3.0

HTML 19.34% JavaScript 80.66%

mime's Introduction

Mime

Small Javascript library for requesting mime string's of a remote resources.

Basicly it request a resource via HEAD method (to save bandwidth) and returns the Content-Type header.

Problems

You currently cannot use this library under the following contitions:

  • The remote resource has no Access-Control-Origin header or it explicit disallows cross side request.
  • The remote resource does not define the Control-Type header.

The cross side request problem will be solved in the future via a fallback proxy. Currently not implemented.

Demo

See the example in the repo for a demonstration.

Usage

The only function you need to know is the get function. It returns a Promise with getting the Content-Type header for you.

var url = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Chili_dog_with_fries.jpg/1920px-Chili_dog_with_fries.jpg";
mime.get(ur).then(function(m) {
  console.log(m);
});

To-Do

  • Requesting via proxy
  • Method for requesting via sync XMLHttpRequest

mime's People

Watchers

James Cloos avatar Aaron Schmid avatar  avatar

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.