pify for gm doesn't seems to be working
See original GitHub issueHi,
I’m trying to fix AVA tests for some functionality and I need to Promisify gm(...).size()
function. Unfortunately I’m not able to do that properly:
const out = await pify(gm(image.data).size());
console.log("gm output: " + out.width);
---
gm output: undefined
const out = await pify(gm(image.data).size)();
console.log("gm output: " + out.width);
---
1 failed
resize-jpeg › Resize JPEG with jpegoptim
Error: Cannot read property 'size' of undefined
proto.(anonymous function) (node_modules/gm/lib/getters.js:47:20)
node_modules/pify/index.js:29:7
node_modules/pify/index.js:12:10
ret (node_modules/pify/index.js:56:34)
Test.<anonymous> (test/resize-jpeg.js:37:20)
Generator.next (<anonymous>)
const out = await pify(gm(image.data).size.bind(gm))();
console.log("gm output: " + out.width);
---
1 failed
resize-jpeg › Resize JPEG with jpegoptim
Error: Cannot read property 'size' of undefined
proto.(anonymous function) (node_modules/gm/lib/getters.js:47:20)
node_modules/pify/index.js:29:7
node_modules/pify/index.js:12:10
ret (node_modules/pify/index.js:56:34)
Test.<anonymous> (test/resize-jpeg.js:37:20)
Generator.next (<anonymous>)
const out = await pify(gm(image.data)).size();
console.log("gm output: " + out.width);
---
1 failed
resize-jpeg › Resize JPEG with jpegoptim
Error: pify(...).size is not a function
Test.<anonymous> (test/resize-jpeg.js:37:43)
Generator.next (<anonymous>)
So, my question is: if it’s possible to pify
gm
and if so, I would like to know how?
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
How to Diagnose Your Engine Control Unit - Symptoms of Bad ...
Our step-by-step guide will help you diagnose your ECU with symptoms of bad/faulty units, testing recommendations & an affordable ECU repair service.
Read more >How flexible is Shopify Plus? With Loren Padelford, VP & GM ...
Shopify themselves doesn't think so. My goal with all of this content I create is to get you the truth by cutting through...
Read more >Set up the Google channel - Shopify Help Center
Set up the Google channel to sync products to Google and for use in Google Performance Max campaigns.
Read more >Lane Keep Assist Safety Feature | Vehicle Support | Chevy
Lane Keep Assist with Lane Departure Warning uses a brief, gentle steering wheel turn to alert † you when you may be unintentionally...
Read more >Complete Cylinder Heads Guide for Big-Block Chevy Engines
Note that domed pistons designed for open chamber cylinder heads do not work with closed chamber heads due to insufficient clearance. While introduced...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Btw,
bind-all
provides the same functionality as mybind
helper above:Thanks to your advice I did end up with code, that is working perfectly fine! https://github.com/secretescapes/aws-lambda-image/blob/improving-tests-quality-v2/test/resize-jpeg.js