blob: 16a5c36e96a8f2100b1c3bf78f55507cf35784f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# read-cache [![Build Status](https://travis-ci.org/TrySound/read-cache.svg?branch=master)](https://travis-ci.org/TrySound/read-cache)
Reads and caches the entire contents of a file until it is modified.
## Install
```
$ npm i read-cache
```
## Usage
```js
// foo.js
var readCache = require('read-cache');
readCache('foo.js').then(function (contents) {
console.log(contents);
});
```
## API
### readCache(path[, encoding])
Returns a promise that resolves with the file's contents.
### readCache.sync(path[, encoding])
Returns the content of the file.
### readCache.get(path[, encoding])
Returns the content of cached file or null.
### readCache.clear()
Clears the contents of the cache.
## License
MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)
|