Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/floatdrop/require-or-die
Require common-js modules and js files that return values
https://github.com/floatdrop/require-or-die
Last synced: about 1 month ago
JSON representation
Require common-js modules and js files that return values
- Host: GitHub
- URL: https://github.com/floatdrop/require-or-die
- Owner: floatdrop
- Created: 2014-08-21T05:14:04.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-15T11:22:42.000Z (almost 10 years ago)
- Last Synced: 2024-10-26T21:11:06.710Z (3 months ago)
- Language: JavaScript
- Size: 195 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# require-or-die
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url]
Requires common.js modules as well as simple js files, that returns values.
## Usage
```js
var rod = require('require-or-die');rod('./sample.js', function (err, value) {
console.log(value);
})
```### API
#### require(path, [options], callback)
###### path
Type: `String`Path to required file (will be resolved by `require.resolve`).
###### options
Type: `Object`Options, that will be passed to fs.readFile.
###### callback
Type: `Function`Function, that will be called, when contents is read and processed. Signature pretty common: `function (err, value)`.
#### require.sync(path)
Same as `require`, but in sync way.
## License
MIT (c) 2014 Vsevolod Strukchinsky
[npm-url]: https://npmjs.org/package/require-or-die
[npm-image]: http://img.shields.io/npm/v/require-or-die.svg?style=flat[travis-url]: http://travis-ci.org/floatdrop/require-or-die
[travis-image]: http://img.shields.io/travis/floatdrop/require-or-die.svg?branch=master&style=flat[depstat-url]: https://david-dm.org/floatdrop/require-or-die
[depstat-image]: http://img.shields.io/david/floatdrop/require-or-die.svg?style=flat