Files
DefinitelyTyped/types/snekfetch/snekfetch-tests.ts
Iker Pérez Brunelli 3a5fa63942 Add snekfetch type definitions (#16214)
* Add snekfetch typings

* Fix linting errors

* Remove unsused import

* Make interfaces and types available to import
2017-05-01 14:46:38 -07:00

13 lines
377 B
TypeScript

import * as fs from 'fs';
import * as snekfetch from 'snekfetch';
snekfetch.get('https://s.gus.host/o-SNAKES-80.jpg')
.then(r => fs.writeFile('download.jpg', r.body));
snekfetch.get('https://s.gus.host/o-SNAKES-80.jpg')
.pipe(fs.createWriteStream('download.jpg'));
snekfetch.post('https://httpbin.org/post')
.send({ meme: 'dream' })
.then(r => console.log(r.body));