mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
16 lines
454 B
TypeScript
16 lines
454 B
TypeScript
import * as fs from 'fs';
|
|
import * as util from 'util';
|
|
import snekfetch = require('snekfetch');
|
|
|
|
const writeFile = util.promisify(fs.writeFile);
|
|
|
|
snekfetch.get('https://s.gus.host/o-SNAKES-80.jpg')
|
|
.then(r => 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));
|