Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nice Module but i can' use Buffer directly #58

Open
xelaz opened this issue Nov 2, 2016 · 1 comment
Open

Nice Module but i can' use Buffer directly #58

xelaz opened this issue Nov 2, 2016 · 1 comment

Comments

@xelaz
Copy link

xelaz commented Nov 2, 2016

Hey,

you have nice Module, but i can't use Buffer as File(path) directly.

import calipers from 'calipers';

const Calipers = calipers('png', 'jpeg');

express.post('/upload', function(req, res) {
  // this is my Buffer of my uploaded file
  Calipers.measure(req.files.image.data).then(...).catch(...);
});

Or if i have Stream and i get the Buffer.

The Problem is, that image-size show me wrong sizes. And i was trying your module but i can't use it without Buffer interface :(

@mgartner
Copy link
Member

This isn't something we've added because its usually best to keep large image files on disk rather than in memory where they can end up consuming a lot of RAM.

This is a good suggestion though, I'm sure there are situations in which dealing with a buffer would be preferred.

Adding support for this for the image formats should be fairly straight forward as they load the file into a buffer from the get-go anyway. Adding support for PDFs might be a bit more complicated because it relies on Poppler and poppler-simple which doesn't support Buffers at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants