From 4d5f63b950d3fb66841c8837d815472e5b32439e Mon Sep 17 00:00:00 2001 From: Anis Jonischkeit Date: Thu, 29 Jul 2021 02:12:10 +1000 Subject: [PATCH] allow image buffer upload --- lib/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/index.js b/lib/index.js index 9060571..b1d5e38 100644 --- a/lib/index.js +++ b/lib/index.js @@ -370,6 +370,8 @@ class Instagram { if (isUrl(photo)) { // Enconding: null is required, only this way a Buffer is returned file = await request.get({ url: photo, encoding: null }) + } else if (Buffer.isBuffer(photo)) { + file = await photo } else { file = await fs.readFileSync(photo) }