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

Supports decoding & encoding from Buffer #8

Open
nagayev opened this issue Oct 5, 2018 · 2 comments
Open

Supports decoding & encoding from Buffer #8

nagayev opened this issue Oct 5, 2018 · 2 comments

Comments

@nagayev
Copy link

nagayev commented Oct 5, 2018

I want to use node-flif so:

var buffer = fs.readFileSync('file')
var decodeParams={
 outputBuffer:buffer
}
var data = fliff.decode(decodeParams);
@TheJaredWilcurt
Copy link
Member

@nagayev2002

node-flif takes in a JavaScript object of settings, and then converts them into a string of command line arguments for the flif executable.

var nodeFLIF = require('node-flif');
var decodeParams = {
    input: './sample/cat.flif',
    output: './sample/cat.png',
    overwrite: true
};

nodeFLIF.decode(decodeParams, function (data) {
    console.log('Decode cat.flif -> cat.png finished');
    if (data) {
        console.log(data);
    }
});

What that actually does is run Node's child_process.exec command with

flif.exe -d -o "./sample/cat.flif" "./sample/cat.png"

Unless you can find a way for the flif executable to accept buffers/blobs, then node-flif will not be able to. Or for node-flif to store the buffer/blob as a file in a temp location, then read in the output file as a stream/buffer/blob and pass it back. There would still be file system read/writes occurring but it would be done for the user. Not sure of how useful that would be for people.

@nagayev
Copy link
Author

nagayev commented Oct 11, 2018

@TheJaredWilcurt Okey :-(

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

No branches or pull requests

2 participants