https://github.com/tiagodanin/require-from-web
Import/Load/Require module from url
https://github.com/tiagodanin/require-from-web
import node-module require
Last synced: about 1 year ago
JSON representation
Import/Load/Require module from url
- Host: GitHub
- URL: https://github.com/tiagodanin/require-from-web
- Owner: TiagoDanin
- License: mit
- Created: 2018-10-08T15:50:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-03T21:21:49.000Z (over 1 year ago)
- Last Synced: 2025-04-02T15:38:55.576Z (about 1 year ago)
- Topics: import, node-module, require
- Language: JavaScript
- Homepage: https://tiagodanin.github.io/Require-From-Web/
- Size: 282 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Require From Web
[](https://travis-ci.org/TiagoDanin/Require-From-Web) [](https://npmjs.org/package/require-from-web) [](https://npmjs.org/package/require-from-web) [](https://npmjs.org/package/require-from-web) [](https://github.com/xojs/xo)
Import/Load/Require module from url
## Installation
Module available through the [npm registry](https://www.npmjs.com/). It can be installed using the [`npm`](https://docs.npmjs.com/getting-started/installing-npm-packages-locally) or [`yarn`](https://yarnpkg.com/en/) command line tools.
```sh
# NPM
npm install require-from-web --save
# Or Using Yarn
yarn add require-from-web
```
## Example
```js
const requireFromWeb = require('require-from-web')
const url = 'https://unpkg.com/jformat@1.0.4/index.js'
requireFromWeb(url).then(format => {
const text = format('Forever {Python}', {Python: 'JavaScript'})
console.log(text) // Forever JavaScript
})
```
## Documentation
### Options :: requireFromWeb(url, axiosOptions, code)
#### url
Url of file.
Type: `String`
#### axiosOptions**
Config/option of Axios.
Type: `Object`
#### code
Add more code in end script.
Type: `String`
## Tests
To run the test suite, first install the dependencies, then run `test`:
```sh
# NPM
npm test
# Or Using Yarn
yarn test
```
## Dependencies
- [axios](https://ghub.io/axios): Promise based HTTP client for the browser and node.js
## Dev Dependencies
- [xo](https://ghub.io/xo): JavaScript happiness style linter ❤️
## Contributors
Pull requests and stars are always welcome. For bugs and feature requests, please [create an issue](https://github.com/TiagoDanin/Require-From-Web/issues). [List of all contributors](https://github.com/TiagoDanin/Require-From-Web/graphs/contributors).
## License
[MIT](LICENSE) © [Tiago Danin](https://TiagoDanin.github.io)