Last active
March 8, 2017 03:39
-
-
Save ryanhugh/a019bb57b00e6da641960f4076c14e8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Same API as the built in fs module, but supports es6 "await" | |
import fs from 'fs-promise'; | |
// I like superagent because it works in both the frontend and the backend | |
// supports, es6 "await", and has a pretty good API :) | |
import superagent from 'superagent'; | |
// Download this file and the package.json into the same directory, | |
// and then run npm install (or yarn) to install the modules | |
// Run this file with babel-node (https://babeljs.io/docs/usage/cli/) | |
// or compile it with babel and then run it with node | |
async function main() { | |
var resp = await superagent.get('https://en.wikipedia.org/wiki/George_Washington') | |
await fs.writeFile('george_washington.html', resp.text) | |
console.log("File downloaded!"); | |
} | |
main() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "redux-minimal", | |
"version": "1.0.0", | |
"babel": { | |
"presets": [ | |
"es2015", | |
"stage-1" | |
], | |
"env": { | |
"*": { | |
"plugins": [ | |
"transform-decorators-legacy", | |
"transform-object-rest-spread" | |
] | |
} | |
} | |
}, | |
"dependencies": { | |
"babel-preset-stage-1": "^6.22.0", | |
"fs-promise": "^2.0.0", | |
"superagent": "^3.5.0" | |
}, | |
"devDependencies": { | |
"babel-core": "^6.21.0", | |
"babel-loader": "^6.2.10", | |
"babel-polyfill": "^6.22.0", | |
"babel-preset-es2015": "^6.18.0", | |
"babel-preset-react": "^6.16.0", | |
"babel-preset-stage-3": "^6.17.0", | |
"babel-runtime": "^6.20.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment