-
Notifications
You must be signed in to change notification settings - Fork 20
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
File transformers cannot handle binary files #105
Comments
Thanks – this is fixed in 0.11.2. Use function myPlugin ( inputBuffer ) {
return doSomethingWith( inputBuffer );
}
myPlugin.defaults = {
sourceEncoding: null
}; |
👍 |
Unless I'm mistaken, file transformers cannot be async, right? If that's the case, it's quite unfortunate because it means that one has to chose between async or caching but can't have both? For example: I want to have a gobble plugin for imagemin. Since optimizing is onerous and a 1-to-1 op, I'd rather use a file transform. But imagemin processors are async so it's a no go 😞 |
I guess it should be possible for Gobble to detect when a file transformer returns an instance of |
Ideally yes. And also maybe use the number of arguments trick (like for the directory transformer) so that one can use a callback instead of returning a promise. But for the moment, it seems that gobble just assumes that the returned value is the transformed contents (see Line 75 in f508f0b
|
I've opened a feature request (#112) for this btw. |
Gobble provides the contents of an individual file to a file transformer plugin as text input.
This prevents a file transformer from handling binary files which is quite a bummer.
For example, since image optimisation can be quite onerous in terms of performance, a file transformer for image optimisation could be more performant than a directory transformer thanks to caching.
The text was updated successfully, but these errors were encountered: