Created
June 30, 2015 03:50
-
-
Save ajcrites/d721ba1e70d8f5db5941 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import request from "request-promise"; | |
import {readFile, writeFile} from "mz/fs"; | |
let uri = "http://localhost:8917"; | |
request.get({uri}) | |
.then(body => writeFile(__dirname + "/foo", body)) | |
.then(() => readFile(__dirname + "/foo")) | |
.then(contents => writeFile(__dirname + "/bar", contents.toString().split("").reverse().join(""))) | |
.then(() => request({uri, method: "POST"})) | |
.then(res => console.log("posted file")) | |
.catch(err => console.error(err.stack)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment