Skip to content

Latest commit

 

History

History

nodejs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Nodejs Usage Example

Using Got - Lightweight HTTP request library for Node.js

Basic Usage

const got = require('got');
const response = await got.post('http://qrcode.show/', {
	body: 'This is Nodejs',
});

Adjust Width & Height

const got = require('got');
const response = await got.post('http://qrcode.show/', {
	body: 'This is Nodejs',
	headers:{
		'X-QR-Width': '50',
		'X-QR-Height': '50'
	}
});
console.log(response.body);

Save QRCode as PNG file

const got = require('got');
const fs = require('fs');
const response = await got.post('http://qrcode.show/',{
	body: 'This is Nodejs',
	headers:{
		accept:'image/png'
	}
});
fs.writeFileSync('qrcode.png',response.rawBody)

List of all headers

http://qrcode.show/