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

Add buffer support #3

Closed
terribleplan opened this issue Oct 23, 2014 · 4 comments
Closed

Add buffer support #3

terribleplan opened this issue Oct 23, 2014 · 4 comments

Comments

@terribleplan
Copy link

It would be nice if buffers were natively supported to enable the following pattern:

var fs = require('fs'),
    stripCssComments = require('strip-css-comments');

fs.readFile('./file.css', function(err,buf){
    console.log(stripCssComments(buf));
});

which is quite natural to use in node.

Worst case you could just turn buffers to strings with .toString()

@sindresorhus
Copy link
Owner

Yup, I wanted to support that, but would prefer to strip out the comments without even having to convert it to a string. Would probably be faster too #1.

@kevva
Copy link

kevva commented Oct 24, 2014

How would you do that? Checking for the comment bytes and just removing them that way?

@sindresorhus
Copy link
Owner

I think so.

@sindresorhus
Copy link
Owner

Alright, so turns out buffers are actually slower than strings for this in latest Node.

See #9

So going with just converting the Buffer to a string for now...

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

Successfully merging a pull request may close this issue.

3 participants