Coder Social home page Coder Social logo

unpkg's Introduction

unpkg Travis

unpkg is a fast, global content delivery network for everything on npm. Use it to quickly and easily load any file from any package using a URL like:

unpkg.com/:package@:version/:file

Examples

Using a fixed version:

You may also use a semver range or a tag instead of a fixed version number, or omit the version/tag entirely to use the latest tag.

If you omit the file path (i.e. use a "bare" URL), unpkg will serve the file specified by the unpkg field in package.json, or fall back to main.

Append a / at the end of a URL to view a listing of all the files in a package.

Query Parameters

?meta
Return metadata about any file in a package as JSON (e.g. `/any/file?meta`)
?module
Expands all ["bare" `import` specifiers](https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier) in JavaScript modules to unpkg URLs. This feature is *very experimental*

Cache Behavior

The CDN caches files based on their permanent URL, which includes the npm package version. This works because npm does not allow package authors to overwrite a package that has already been published with a different one at the same version number.

URLs that do not specify a package version number redirect to one that does. This is the latest version when no version is specified, or the maxSatisfying version when a semver version is given. Redirects are cached for 5 minutes.

Browsers are instructed (via the Cache-Control header) to cache assets for 4 hours.

Feedback

If you think this is useful, we'd love to hear from you. Please reach out to @unpkg with any questions or concerns.

Sponsors

The project is sponsored by Cloudflare and Heroku.

unpkg's People

Contributors

mjackson avatar tikotzky avatar jgravois avatar webreflection avatar barneycarroll avatar developit avatar lfaraone avatar patrickjs avatar timdorr avatar radubrehar avatar cg-cnu avatar

Watchers

James Cloos avatar Anton Harniakou 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.