Skip to content

Instantly share code, notes, and snippets.

@dawsbot dawsbot/curl.js
Last active Mar 23, 2017

What would you like to do?
es6AF way to curl to tempfile
const url = '';
const pify = require('pify');
const fs = pify(require('fs'));
const fetch = require('node-fetch');
const tempfile = require('tempfile');
const curl = (package, version) => {
.then(res => res.text())
.then(res => {
const tmpFile = tempfile();
fs.writeFile(tmpFile, res, 'utf-8')
.then(res => {
console.log('tmpFile: ', tmpFile);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.