Skip to content
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.

Latest commit

 

History

History
24 lines (17 loc) · 653 Bytes

README.MD

File metadata and controls

24 lines (17 loc) · 653 Bytes

superagent-binary-parser is a superagent plugin, created to parse binary response stream (pdf, zip, etc...)

Installation

npm install superagent-binary-parser --save

Usage

const binaryParser = require('superagent-binary-parser');
const superagent = require('superagent');

superagent.get('https://philosophiatopics.files.wordpress.com/2018/10/skin-in-the-game-nassim-nicholas-taleb.pdf')
	.parse(binaryParser)
	.buffer()
	.end((err, resp) => {
		//resp.body is a buffer
		fs.writeFileSync('./resp.pdf', resp.body)
	})