{"id":20673512,"url":"https://github.com/gngeorgiev/lrequire","last_synced_at":"2026-04-17T14:32:31.077Z","repository":{"id":78165492,"uuid":"93414572","full_name":"gngeorgiev/lrequire","owner":"gngeorgiev","description":":boom: Live-require npm modules, without installing them first.","archived":false,"fork":false,"pushed_at":"2017-06-07T13:13:49.000Z","size":44,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-17T14:22:28.744Z","etag":null,"topics":["live","npm","require"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gngeorgiev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-05T14:49:03.000Z","updated_at":"2018-02-03T14:23:21.000Z","dependencies_parsed_at":"2023-02-26T19:45:15.812Z","dependency_job_id":null,"html_url":"https://github.com/gngeorgiev/lrequire","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gngeorgiev%2Flrequire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gngeorgiev%2Flrequire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gngeorgiev%2Flrequire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gngeorgiev%2Flrequire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gngeorgiev","download_url":"https://codeload.github.com/gngeorgiev/lrequire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242900010,"owners_count":20203704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["live","npm","require"],"created_at":"2024-11-16T20:41:41.801Z","updated_at":"2026-04-17T14:32:26.055Z","avatar_url":"https://github.com/gngeorgiev.png","language":"JavaScript","readme":"# Live-require\n\n[![NPM](https://nodei.co/npm/lrequire.png?mini=true)](https://npmjs.org/package/lrequire) [![Build Status](https://travis-ci.org/gngeorgiev/lrequire.svg?branch=master)](https://travis-ci.org/gngeorgiev/lrequire) [![dependencies](https://david-dm.org/gngeorgiev/lrequire.svg)]() [![Code Climate](https://codeclimate.com/github/gngeorgiev/lrequire/badges/gpa.svg)](https://codeclimate.com/github/gngeorgiev/lrequire)\n\nA module which allows you to require and try out npm modules directly without `npm install`-ing them. You can use this to quickly test out different modules in your project, inside a toy project or in the terminal.\n\n# How it works\n\nModules are downloaded and prepared in a predefined directory(`/tmp` by default) and then required back to you. The modules are cached so only the first time a module is used it might take a little longer to load.\n\n# Configuration\n\n```javascript\nconst lrequire = require('lrequire');\n\nlrequire.configure({\n    path: '/tmp/lrequire' //where the modules will be downloaded\n})\n```\n\n# Programmatic Usage\n\nBasic:\n\n```javascript\nconst lrequire = require('lrequire');\n\nconst validUrl = lrequire('valid-url');\nconst latestVersion = lrequire('npmjs.org/package/latest-version');\n```\n\nDownload specific version:\n\n```javascript\nconst lrequire = require('lrequire');\n\nconst validUrl = lrequire('valid-url', {\n    version: '1.0.8'\n});\nconst latestVersion = lrequire('npmjs.org/package/latest-version', {\n    version: 'latest' //this is the default\n});\n```\n\nYou can also make `lrequire` global and use it at will. Later, if you wish to keep a package, you can remove the `l` and everything will continue working.\n\n```javascript\nrequire('lrequire').global();\n\nconst validUrl = lrequire('valid-url');\nconst latestVersion = lrequire('npmjs.org/package/latest-version');\n```\n\n# Repl Usage\n\nMake sure to install `lrequire` globally:\n\n```bash\n$ npm i -g lrequire\n```\n\nExecute `lrequire` in your terminal, the `lrequire` function will be available in the newly opened repl which means you can directly start requiring modules. You can also use the `require` function, it will try to require a module and fallback to `lrequire`.\n\n```bash\n$ lrequire\n\u003e const { markdown } = require('markdown');\n\u003e $ markdown.toHTML('Hello *World*!');\n'\u003cp\u003eHello \u003cem\u003eWorld\u003c/em\u003e!\u003c/p\u003e'\n```\n\n# What if you don't want to create files on your filesystem?\n\nOn linux consider using [tmpfs](https://wiki.archlinux.org/index.php/tmpfs). You can mount it on `/tmp/lrequire` or even `/tmp` which is a common practice. Don't forget that the directory where the files are saved can be configured.\n\nOn MacOS and Windows there are some RamDisk implementations that might work.\n\n# Requirements\n\nNode 8\n\n# API Reference\n\n## lrequire(module, config = {version: 'latest'})\nRequire a module synchronously.\n\n## lrequire.async(module, config = {version: 'latest'}): Promise\\\u003cModule\\\u003e\nRequire a module asynchronously, the result can be awaited.\n\n## lrequire.asyncCallback(module, config, callback)\nRequire a module asynchronously, the result is passed as a second argument as per the node.js callback conventions.\n\n## lrequire.config(config = {path: '/tmp/lrequire'})\nConfigure `lrequire`.\n\n## lrequire.global()\nAdd `lrequire` to `global`.\n\n## lrequire.config\nGet the config object\n\n## lrequire.latestVersionCache\nGet the cache which holds the latest version available in npm for each package installed during the application's lifetime.\n\n# License - MIT\n\nThe MIT License (MIT)\nCopyright (c) 2017 lrequire\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgngeorgiev%2Flrequire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgngeorgiev%2Flrequire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgngeorgiev%2Flrequire/lists"}