import 'dotenv/config' ; import { IgApiClient } from '../src' ; import { get } from 'request-promise' ; ( async ( ) => { const ig = new IgApiClient ( ) ; ig . state . generateDevice ( process . env . IG_USERNAME ) ; ig . state . proxyUrl = process . env . IG_PROXY ; const auth = await ig . account . login ( process . env . IG_USERNAME , process . env . IG_PASSWORD ) ; console . log ( JSON . stringify ( auth ) ) ; const imageBuffer = await get ( { url : 'https://picsum.photos/800/800' , encoding : null , } ) ; const publishResult = await ig . publish . photo ( { file : imageBuffer , caption : 'Really nice photo from the internet! 💖' , } ) ; console . log ( publishResult ) ; } ) ( ) ;