Skip to content

Commit 10d6916

Browse files
committed
Docs: Update examples
1 parent a2483d7 commit 10d6916

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.github/
2+
coverage/
3+
.nyc_output/

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Blaine Bublitz <[email protected]>
3+
Copyright (c) 2018,2020 Blaine Bublitz <[email protected]>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Download the contents of a given directory from a repository on GitHub.
44

5-
Only works in node 8+ (because `async/await` is too cool).
5+
Only works in node 10.13+
66

77
## Usage
88

@@ -15,9 +15,25 @@ Best used from the command line:
1515
Or programatic:
1616

1717
```js
18-
var download = require("github-download-directory");
18+
var downloader = require('github-download-directory');
1919

20-
download("gulpjs", "gulp", "docs").then(console.log, console.error);
20+
downloader.download('gulpjs', 'gulp', 'docs').then(console.log, console.error);
21+
```
22+
23+
You can also construct a downloader instance:
24+
```js
25+
var { Downloader } = require('github-download-directory');
26+
27+
// You can even include custom cache stores compatible with https://www.npmjs.com/package/keyv
28+
var KeyvFile = require('keyv-file').KeyvFile;
29+
var store = new KeyvFile();
30+
31+
var custom = new Downloader({
32+
cache: { store },
33+
github: { auth: 'SOME_AUTH_TOKEN' }
34+
})
35+
36+
custom.download('gulpjs', 'gulp', 'docs').then(console.log, console.error);
2137
```
2238

2339
## License

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
"mocha": "^7.2.0",
3333
"nyc": "^15.1.0"
3434
},
35+
"prettier": {
36+
"singleQuote": true
37+
},
3538
"keywords": [
3639
"github",
3740
"fetch",

0 commit comments

Comments
 (0)